Skip to content

Commit ff51904

Browse files
authored
Merge pull request #148 from RobLoach/update-2021-10-17
Update to raylib 4.0.0
2 parents 788b1af + 0213c8f commit ff51904

35 files changed

+233
-211
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8-
## [x.x.x] - xxxx-xx-xx
8+
## [4.0.0] - 2021-11-04
99
### Changes
10+
- Update to [raylib 4.0.0](https://github.com/raysan5/raylib/releases/tag/4.0.0)
1011
- For tests, replaced catch.hpp with `assert()` calls
1112
- Added assignment operators for objects ([#142](https://github.com/RobLoach/raylib-cpp/pull/142) by [@marciejewiczow](https://github.com/maciejewiczow))
1213
- Replaced `NULL` with `nullptr`

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 3.7.0
4+
VERSION 4.0.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/core/core_random_values.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int main() {
4747

4848
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
4949

50-
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
50+
DrawText(TextFormat("%i", randValue), 360, 180, 80, LIGHTGRAY);
5151
}
5252
EndDrawing();
5353
//----------------------------------------------------------------------------------

examples/models/models_first_person_maze.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main(void)
3030

3131
// NOTE: By default each cube is mapped to one part of texture atlas
3232
raylib::Texture texture("resources/cubicmap_atlas.png"); // Load map texture
33-
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
33+
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
3434

3535
// Get map image data to be used for collision detection
3636
Color *mapPixels = imMap.LoadColors();

examples/shapes/shapes_collision_area.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int main(void)
8989
DrawText("COLLISION!", GetScreenWidth()/2 - MeasureText("COLLISION!", 20)/2, screenUpperLimit/2 - 10, 20, BLACK);
9090

9191
// Draw collision area
92-
DrawText(FormatText("Collision Area: %i", (int)boxCollision.width*(int)boxCollision.height), GetScreenWidth()/2 - 100, screenUpperLimit + 10, 20, BLACK);
92+
DrawText(TextFormat("Collision Area: %i", (int)boxCollision.width*(int)boxCollision.height), GetScreenWidth()/2 - 100, screenUpperLimit + 10, 20, BLACK);
9393
}
9494

9595
DrawFPS(10, 10);

examples/textures/textures_bunnymark.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ int main(void)
103103
}
104104

105105
DrawRectangle(0, 0, screenWidth, 40, BLACK);
106-
DrawText(FormatText("bunnies: %i", bunnies.size()), 120, 10, 20, GREEN);
107-
DrawText(FormatText("batched draw calls: %i", 1 + bunnies.size()/MAX_BATCH_ELEMENTS), 320, 10, 20, MAROON);
106+
DrawText(TextFormat("bunnies: %i", bunnies.size()), 120, 10, 20, GREEN);
107+
DrawText(TextFormat("batched draw calls: %i", 1 + bunnies.size()/MAX_BATCH_ELEMENTS), 320, 10, 20, MAROON);
108108

109109
DrawFPS(10, 10);
110110
}

include/AudioStream.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AudioStream : public ::AudioStream {
1818
* Init audio stream (to stream raw audio pcm data)
1919
*/
2020
AudioStream(unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels = 2) {
21-
set(InitAudioStream(SampleRate, SampleSize, Channels));
21+
set(LoadAudioStream(SampleRate, SampleSize, Channels));
2222
}
2323

2424
AudioStream(const AudioStream&) = delete;
@@ -33,7 +33,7 @@ class AudioStream : public ::AudioStream {
3333
}
3434

3535
~AudioStream() {
36-
Close();
36+
Unload();
3737
}
3838

3939
GETTERSETTER(rAudioBuffer *, Buffer, buffer)
@@ -53,7 +53,7 @@ class AudioStream : public ::AudioStream {
5353
return *this;
5454
}
5555

56-
Close();
56+
Unload();
5757
set(other);
5858

5959
other.buffer = nullptr;
@@ -73,10 +73,10 @@ class AudioStream : public ::AudioStream {
7373
}
7474

7575
/**
76-
* Close audio stream and free memory
76+
* Unload audio stream and free memory
7777
*/
78-
inline void Close() {
79-
::CloseAudioStream(*this);
78+
inline void Unload() {
79+
::UnloadAudioStream(*this);
8080
}
8181

8282
/**

include/BoundingBox.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BoundingBox : public ::BoundingBox {
1818
* Compute mesh bounding box limits
1919
*/
2020
BoundingBox(const ::Mesh& mesh) {
21-
set(::MeshBoundingBox(mesh));
21+
set(::GetMeshBoundingBox(mesh));
2222
}
2323

2424
BoundingBox(::Vector3 minMax) : ::BoundingBox{minMax, minMax} {}
@@ -58,7 +58,14 @@ class BoundingBox : public ::BoundingBox {
5858
* Detect collision between ray and bounding box
5959
*/
6060
inline bool CheckCollision(const ::Ray& ray) const {
61-
return CheckCollisionRayBox(ray, *this);
61+
return GetRayCollisionBox(ray, *this).hit;
62+
}
63+
64+
/**
65+
* Get collision information between ray and bounding box
66+
*/
67+
inline RayCollision GetCollision(const ::Ray& ray) const {
68+
return GetRayCollisionBox(ray, *this);
6269
}
6370

6471
private:

include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ install(FILES
2525
physac.hpp
2626
Physics.hpp
2727
Ray.hpp
28-
RayHitInfo.hpp
28+
RayCollision.hpp
2929
raylib-cpp-utils.hpp
3030
raylib-cpp.hpp
3131
raylib.hpp

include/Camera3D.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class Camera3D : public ::Camera3D {
143143
const ::Texture2D& texture,
144144
::Rectangle sourceRec,
145145
::Vector3 center,
146-
float size,
146+
::Vector2 size,
147147
::Color tint = {255, 255, 255, 255}) {
148148
::DrawBillboardRec(*this, texture, sourceRec, center, size, tint);
149149
return *this;

0 commit comments

Comments
 (0)