Skip to content

Commit 7133302

Browse files
authored
Merge pull request #235 from RobLoach/update-4.5.0
Update to raylib v4.5.0
2 parents df0cbb4 + c1744de commit 7133302

21 files changed

+54
-197
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.11)
22
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
33
project (raylib_cpp
4-
VERSION 4.2.8
4+
VERSION 4.5.0
55
DESCRIPTION "raylib-cpp C++ Object Oriented Wrapper for raylib"
66
HOMEPAGE_URL "https://github.com/robloach/raylib-cpp"
77
LANGUAGES C CXX

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (NOT raylib_FOUND)
1515
FetchContent_Declare(
1616
raylib
1717
GIT_REPOSITORY https://github.com/raysan5/raylib.git
18-
GIT_TAG 4.2.0
18+
GIT_TAG 4.5.0
1919
)
2020
FetchContent_GetProperties(raylib)
2121
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?

examples/core/core_3d_camera_first_person.cpp

Lines changed: 0 additions & 88 deletions
This file was deleted.

examples/core/core_world_screen.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ int main() {
3030
Vector3 cubePosition;
3131
Vector2 cubeScreenPosition;
3232

33-
camera.SetMode(CAMERA_FREE); // Set a free camera mode
34-
3533
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
3634
//--------------------------------------------------------------------------------------
3735

3836
// Main game loop
3937
while (!window.ShouldClose()) { // Detect window close button or ESC key
4038
// Update
4139
//----------------------------------------------------------------------------------
42-
camera.Update(); // Update camera
40+
camera.Update(CAMERA_THIRD_PERSON); // Update camera
4341

4442
// Calculate cube screen space position (with a little offset to be in top)
4543
cubeScreenPosition = GetWorldToScreen(Vector3{cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);

examples/models/models_billboard.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ int main() {
3030
raylib::Texture2D bill("resources/billboard.png"); // Our texture billboard
3131
raylib::Vector3 billPosition(0.0f, 2.0f, 0.0f); // Position where draw billboard
3232

33-
camera.SetMode(CAMERA_ORBITAL); // Set an orbital camera mode
34-
3533
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
3634
//--------------------------------------------------------------------------------------
3735

3836
// Main game loop
3937
while (!window.ShouldClose()) { // Detect window close button or ESC key
4038
// Update
4139
//----------------------------------------------------------------------------------
42-
camera.Update(); // Update camera
40+
camera.Update(CAMERA_ORBITAL); // Update camera
4341
//----------------------------------------------------------------------------------
4442

4543
// Draw

examples/models/models_first_person_maze.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ int main(void)
4040
raylib::Vector3 mapPosition(-16.0f, 0.0f, -8.0f); // Set model position
4141
raylib::Vector3 playerPosition(camera.position); // Set player position
4242

43-
camera.SetMode(CAMERA_FIRST_PERSON); // Set camera mode
44-
4543
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
4644
//--------------------------------------------------------------------------------------
4745

@@ -51,7 +49,7 @@ int main(void)
5149
//----------------------------------------------------------------------------------
5250
raylib::Vector3 oldCamPos(camera.position); // Store old camera position
5351

54-
camera.Update(); // Update camera
52+
camera.Update(CAMERA_FIRST_PERSON); // Update camera
5553

5654
// Check player collision (we simplify to 2D collision detection)
5755
raylib::Vector2 playerPos(camera.position.x, camera.position.z);

include/AudioStream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class AudioStream : public ::AudioStream {
195195
* Retrieve whether or not the audio stream is ready.
196196
*/
197197
bool IsReady() {
198-
return channels > 0;
198+
return ::IsAudioStreamReady(*this);
199199
}
200200

201201
/**

include/Camera2D.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ class Camera2D : public ::Camera2D {
4747
}
4848

4949
/**
50-
* Returns the screen space position for a 3d world space position
50+
* Returns the world space position for a 2d camera screen space position
5151
*/
52-
inline Vector2 GetWorldToScreen(::Vector2 position) const {
53-
return ::GetWorldToScreen2D(position, *this);
52+
inline Vector2 GetScreenToWorld(::Vector2 position) const {
53+
return ::GetScreenToWorld2D(position, *this);
5454
}
5555

5656
/**
57-
* Returns the world space position for a 2d camera screen space position
57+
* Returns the screen space position for a 3d world space position
5858
*/
59-
inline Vector2 GetScreenToWorld(::Vector2 position) const {
60-
return ::GetScreenToWorld2D(position, *this);
59+
inline Vector2 GetWorldToScreen(::Vector2 position) const {
60+
return ::GetWorldToScreen2D(position, *this);
6161
}
6262

6363
private:

include/Camera3D.hpp

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -67,45 +67,18 @@ class Camera3D : public ::Camera3D {
6767
}
6868

6969
/**
70-
* Set camera mode (multiple camera modes available)
71-
*/
72-
inline Camera3D& SetMode(int mode) {
73-
::SetCameraMode(*this, mode);
74-
return *this;
75-
}
76-
77-
/**
78-
* Set camera alt key to combine with mouse movement (free camera)
79-
*/
80-
inline Camera3D& SetAltControl(int altKey) {
81-
::SetCameraAltControl(altKey);
82-
return *this;
83-
}
84-
85-
/**
86-
* Set camera smooth zoom key to combine with mouse (free camera)
87-
*/
88-
inline Camera3D& SetSmoothZoomControl(int szKey) {
89-
::SetCameraSmoothZoomControl(szKey);
90-
return *this;
91-
}
92-
93-
/**
94-
* Set camera move controls (1st person and 3rd person cameras)
70+
* Update camera position for selected mode
9571
*/
96-
inline Camera3D& SetMoveControls(
97-
int frontKey, int backKey,
98-
int rightKey, int leftKey,
99-
int upKey, int downKey) {
100-
::SetCameraMoveControls(frontKey, backKey, rightKey, leftKey, upKey, downKey);
72+
inline Camera3D& Update(int mode) {
73+
::UpdateCamera(this, mode);
10174
return *this;
10275
}
10376

10477
/**
105-
* Update camera position for selected mode
78+
* Update camera movement/rotation
10679
*/
107-
inline Camera3D& Update() {
108-
::UpdateCamera(this);
80+
inline Camera3D& Update(::Vector3 movement, ::Vector3 rotation, float zoom = 1.0f) {
81+
::UpdateCameraPro(this, movement, rotation, zoom);
10982
return *this;
11083
}
11184

include/Font.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class Font : public ::Font {
207207
* Returns if the font is ready to be used.
208208
*/
209209
bool IsReady() {
210-
return baseSize > 0;
210+
return ::IsFontReady(*this);
211211
}
212212

213213
/**

0 commit comments

Comments
 (0)