diff --git a/cmake/FindRaylib.cmake b/cmake/FindRaylib.cmake index ca1b362..e812b37 100644 --- a/cmake/FindRaylib.cmake +++ b/cmake/FindRaylib.cmake @@ -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? diff --git a/examples/core/core_basic_window.cpp b/examples/core/core_basic_window.cpp index e323dfe..776ea73 100644 --- a/examples/core/core_basic_window.cpp +++ b/examples/core/core_basic_window.cpp @@ -21,7 +21,7 @@ #include "raylib/raylib.hpp" -int main(int argc, char* argv[]) +int main() { // Initialization //-------------------------------------------------------------------------------------- diff --git a/include/raylib/Camera.hpp b/include/raylib/Camera.hpp new file mode 100644 index 0000000..2a6a3b7 --- /dev/null +++ b/include/raylib/Camera.hpp @@ -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 \ No newline at end of file diff --git a/include/raylib/Camera2D.hpp b/include/raylib/Camera2D.hpp new file mode 100644 index 0000000..df87276 --- /dev/null +++ b/include/raylib/Camera2D.hpp @@ -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 \ No newline at end of file