mirror of
https://github.com/allankoechke/raylib-cpp.git
synced 2026-11-30 10:59:00 +00:00
Update raylib
This commit is contained in:
@@ -4,7 +4,7 @@ if (NOT raylib_FOUND)
|
||||
FetchContent_Declare(
|
||||
raylib
|
||||
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
||||
GIT_TAG d690e734f9d6968f9ef38a6ccdf8a26f26208489
|
||||
GIT_TAG 84fb2e00df86ab727bdae016dc9b58645f7169f2
|
||||
)
|
||||
FetchContent_GetProperties(raylib)
|
||||
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "raylib/raylib.hpp"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
79
include/raylib/Camera.hpp
Normal file
79
include/raylib/Camera.hpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#ifndef RAYLIB_CPP_CAMERA_HPP_
|
||||
#define RAYLIB_CPP_CAMERA_HPP_
|
||||
|
||||
#include "raylib.h"
|
||||
#include "Vector3.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace raylib {
|
||||
class Camera : public ::Camera {
|
||||
public:
|
||||
Camera(Vector3 positionValue, Vector3 targetValue, Vector3 upValue, float fovyValue = 0, int typeValue = 0) {
|
||||
position = positionValue;
|
||||
target = targetValue;
|
||||
up = upValue;
|
||||
fovy = fovyValue;
|
||||
type = typeValue;
|
||||
};
|
||||
|
||||
inline void set(const ::Camera& camera) {
|
||||
position = camera.position;
|
||||
target = camera.target;
|
||||
up = camera.up;
|
||||
fovy = camera.fovy;
|
||||
type = camera.type;
|
||||
}
|
||||
|
||||
inline void set(const Camera& camera) {
|
||||
position = camera.position;
|
||||
target = camera.target;
|
||||
up = camera.up;
|
||||
fovy = camera.fovy;
|
||||
type = camera.type;
|
||||
}
|
||||
|
||||
void BeginMode3D() {
|
||||
::BeginMode3D(*this);
|
||||
}
|
||||
void EndMode3D() {
|
||||
::EndMode3D();
|
||||
}
|
||||
|
||||
Matrix GetCameraMatrix() {
|
||||
return ::GetCameraMatrix(*this);
|
||||
}
|
||||
|
||||
void SetCameraMode(int mode) {
|
||||
::SetCameraMode(*this, mode);
|
||||
}
|
||||
|
||||
void UpdateCamera() {
|
||||
::UpdateCamera(*this);
|
||||
}
|
||||
|
||||
void UpdateVrTracking() {
|
||||
::UpdateVrTracking(this);
|
||||
}
|
||||
|
||||
GETTERSETTER(Vector3,Position,position)
|
||||
GETTERSETTER(Vector3,Target,target)
|
||||
GETTERSETTER(Vector3,Up,up)
|
||||
GETTERSETTER(float,Fovy,fovy)
|
||||
GETTERSETTER(int,Type,type)
|
||||
|
||||
Camera& operator=(const ::Camera& camera) {
|
||||
set(color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Camera& operator=(const Camera& camera) {
|
||||
set(camera);
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef Camera Camera3D;
|
||||
}
|
||||
|
||||
#endif
|
||||
57
include/raylib/Camera2D.hpp
Normal file
57
include/raylib/Camera2D.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef RAYLIB_CPP_CAMERA_HPP_
|
||||
#define RAYLIB_CPP_CAMERA_HPP_
|
||||
|
||||
#include "raylib.h"
|
||||
#include "Vector2.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace raylib {
|
||||
class Camera2D : public ::Camera2D {
|
||||
public:
|
||||
Camera2D(Vector2 offsetValue, Vector2 targetValue, float rotationValue, float zoomValue) {
|
||||
offset = offsetValue;
|
||||
target = targetValue;
|
||||
rotation = rotationValue;
|
||||
zoom = zoomValue;
|
||||
};
|
||||
|
||||
inline void set(const ::Camera2D& camera) {
|
||||
offset = camera.offset;
|
||||
target = camera.target;
|
||||
rotation = camera.rotation;
|
||||
zoom = camera.zoom;
|
||||
}
|
||||
|
||||
inline void set(const Camera2D& camera) {
|
||||
offset = camera.offset;
|
||||
target = camera.target;
|
||||
rotation = camera.rotation;
|
||||
zoom = camera.zoom;
|
||||
}
|
||||
|
||||
void BeginMode2D() {
|
||||
::BeginMode2D(*this);
|
||||
}
|
||||
void EndMode2D() {
|
||||
::EndMode2D();
|
||||
}
|
||||
|
||||
GETTERSETTER(Vector2,Offset,offset)
|
||||
GETTERSETTER(Vector2,Target,target)
|
||||
GETTERSETTER(float,Rotation,rotation)
|
||||
GETTERSETTER(float,Zoom,zoom)
|
||||
|
||||
Camera2D& operator=(const ::Camera2D& camera) {
|
||||
set(color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Camera2D& operator=(const Camera2D& camera) {
|
||||
set(camera);
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user