Skip to content

Commit 96aaff5

Browse files
committed
Update to raylib 5.5
1 parent 3a6e7bb commit 96aaff5

File tree

10 files changed

+96
-12
lines changed

10 files changed

+96
-12
lines changed

clib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "raylib-cpp",
3-
"version": "5.0.1",
3+
"version": "5.5.0",
44
"repo": "RobLoach/raylib-cpp",
55
"description": "raylib-cpp: C++ Object-Oriented Wrapper for raylib",
66
"homepage": "https://github.com/robloach/raylib-cpp",

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 5e6cdf3
18+
GIT_TAG 5.5
1919
GIT_SHALLOW 1
2020
)
2121
FetchContent_GetProperties(raylib)

include/Camera3D.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ class Camera3D : public ::Camera3D {
9191
*/
9292
Vector2 GetWorldToScreen(::Vector3 position) const { return ::GetWorldToScreen(position, *this); }
9393

94+
/**
95+
* Get a ray trace from screen position (i.e mouse) in a viewport
96+
*/
97+
Ray GetScreenToWorldRay(::Vector2 position, int width, int height) {
98+
return ::GetScreenToWorldRayEx(position, *this, width, height);
99+
}
100+
94101
/**
95102
* Draw a billboard texture.
96103
*/

include/Color.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ class Color : public ::Color {
181181

182182
void DrawRectangleLines(::Rectangle rec, float lineThick) const { ::DrawRectangleLinesEx(rec, lineThick, *this); }
183183

184+
bool IsEqual(::Color color) {
185+
return ::ColorIsEqual(*this, color);
186+
}
187+
188+
bool operator==(const ::Color& other) const { return ::ColorIsEqual(*this, other); }
189+
bool operator!=(const ::Color& other) const { return !::ColorIsEqual(*this, other); }
190+
184191
/**
185192
* Get color multiplied with another color
186193
*/
@@ -201,6 +208,10 @@ class Color : public ::Color {
201208
*/
202209
Color Alpha(float alpha) const { return ::ColorAlpha(*this, alpha); }
203210

211+
Color Lerp(::Color color2, float factor) {
212+
return ::ColorLerp(*this, color2, factor);
213+
}
214+
204215
/**
205216
* Returns src alpha-blended into dst color with tint
206217
*/

include/Gamepad.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ class Gamepad {
8585
float GetAxisMovement(int axis) const { return ::GetGamepadAxisMovement(number, axis); }
8686

8787
int SetMappings(const std::string& mappings) { return SetGamepadMappings(mappings.c_str()); }
88+
89+
/**
90+
* Set gamepad vibration for both motors (duration in seconds)
91+
*/
92+
void SetVibration(float leftMotor, float rightMotor, float duration) {
93+
::SetGamepadVibration(number, leftMotor, rightMotor, duration);
94+
}
8895
protected:
8996
void set(int gamepadNumber) { number = gamepadNumber; }
9097
};

include/Image.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ class Image : public ::Image {
164164
*/
165165
static ::Image Cellular(int width, int height, int tileSize) { return ::GenImageCellular(width, height, tileSize); }
166166

167+
/**
168+
* Get clipboard image content.
169+
*/
170+
static ::Image GetClipboard() { return ::GetClipboardImage(); }
171+
167172
~Image() { Unload(); }
168173

169174
Image& operator=(const ::Image& image) {
@@ -605,6 +610,13 @@ class Image : public ::Image {
605610
::ImageDrawLineV(this, start, end, color);
606611
}
607612

613+
/**
614+
* Description: Draw a line defining thickness within an image
615+
*/
616+
void DrawLine(::Vector2 start, ::Vector2 end, int thick, ::Color color = {255, 255, 255, 255}) {
617+
ImageDrawLineEx(this, start, end, thick, color);
618+
}
619+
608620
void DrawCircle(int centerX, int centerY, int radius, ::Color color = {255, 255, 255, 255}) {
609621
::ImageDrawCircle(this, centerX, centerY, radius, color);
610622
}
@@ -629,6 +641,8 @@ class Image : public ::Image {
629641
::ImageDrawRectangleLines(this, rec, thick, color);
630642
}
631643

644+
// TODO: Add ImageDrawTriangle()
645+
632646
void Draw(const ::Image& src, ::Rectangle srcRec, ::Rectangle dstRec, ::Color tint = {255, 255, 255, 255}) {
633647
::ImageDraw(this, src, srcRec, dstRec, tint);
634648
}
@@ -729,6 +743,18 @@ class Image : public ::Image {
729743
* @return True or false depending on whether the Image has been loaded.
730744
*/
731745
bool IsValid() const { return ::IsImageValid(*this); }
746+
747+
/**
748+
* Create an image from a selected channel of another image (GRAYSCALE)
749+
*/
750+
::Image Channel(int selectedChannel) { return ::ImageFromChannel(*this, selectedChannel); }
751+
752+
/**
753+
* Apply custom square convolution kernel to image
754+
*/
755+
void KernelConvolution(const float* kernel, int kernelSize) {
756+
::ImageKernelConvolution(this, kernel, kernelSize);
757+
}
732758
protected:
733759
void set(const ::Image& image) {
734760
data = image.data;

include/MeshUnmanaged.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ class MeshUnmanaged : public ::Mesh {
183183
}
184184
}
185185

186+
/**
187+
* Export mesh as code file (.h) defining multiple arrays of vertex attributes
188+
*
189+
* @throws raylib::RaylibException Throws if failed to export the Mesh.
190+
*/
191+
void ExportCode(const std::string& fileName) {
192+
if (!::ExportMeshAsCode(*this, fileName.c_str())) {
193+
throw RaylibException("Failed to export the Mesh");
194+
}
195+
}
196+
186197
/**
187198
* Compute mesh bounding box limits
188199
*/

include/Model.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ class Model : public ::Model {
127127
return *this;
128128
}
129129

130+
/**
131+
* Update model animation pose
132+
*/
133+
Model& UpdateAnimationBones(const ::ModelAnimation& anim, int frame) {
134+
::UpdateModelAnimationBones(*this, anim, frame);
135+
return *this;
136+
}
137+
130138
/**
131139
* Check model animation skeleton match
132140
*/
@@ -170,6 +178,20 @@ class Model : public ::Model {
170178
::DrawModelWiresEx(*this, position, rotationAxis, rotationAngle, scale, tint);
171179
}
172180

181+
/**
182+
* Draw a model as points
183+
*/
184+
void DrawPoints(::Vector3 position, float scale = 1.0f, ::Color tint = {255, 255, 255, 255}) {
185+
::DrawModelPoints(*this, position, scale, tint);
186+
}
187+
188+
/**
189+
* Draw a model as points
190+
*/
191+
void DrawPoints(::Vector3 position, ::Vector3 rotationAxis, float rotationAngle = 0.0f, ::Vector3 scale = {1.0f, 1.0f, 1.0f}, ::Color tint = {255, 255, 255, 255}) {
192+
::DrawModelPointsEx(*this, position, rotationAxis, rotationAngle, scale, tint);
193+
}
194+
173195
/**
174196
* Compute model bounding box limits (considers all meshes)
175197
*/

include/ModelAnimation.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ class ModelAnimation : public ::ModelAnimation {
8383
return *this;
8484
}
8585

86+
/**
87+
* Update model animation mesh bone matrices (GPU skinning)
88+
*/
89+
ModelAnimation& UpdateBones(const ::Model& model, int frame) {
90+
::UpdateModelAnimationBones(model, *this, frame);
91+
return *this;
92+
}
93+
8694
/**
8795
* Check model animation skeleton match
8896
*/

include/Rectangle.hpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class Rectangle : public ::Rectangle {
6666
color2);
6767
}
6868

69-
void DrawGradient(::Color col1, ::Color col2, ::Color col3, ::Color col4) const {
70-
::DrawRectangleGradientEx(*this, col1, col2, col3, col4);
69+
void DrawGradient(::Color topLeft, ::Color bottomLeft, ::Color topRight, ::Color bottomRight) const {
70+
::DrawRectangleGradientEx(*this, topLeft, bottomLeft, topRight, bottomRight);
7171
}
7272

7373
void DrawLines(::Color color) const {
@@ -86,19 +86,11 @@ class Rectangle : public ::Rectangle {
8686
}
8787

8888
void DrawRoundedLines(float roundness, int segments, ::Color color) const {
89-
#if RAYLIB_VERSION_MAJOR == 5 && RAYLIB_VERSION_MINOR == 0
90-
::DrawRectangleRoundedLines(*this, roundness, segments, 1.0f, color);
91-
#else
9289
::DrawRectangleRoundedLines(*this, roundness, segments, color);
93-
#endif
9490
}
9591

9692
void DrawRoundedLines(float roundness, int segments, float lineThick, ::Color color) const {
97-
#if RAYLIB_VERSION_MAJOR == 5 && RAYLIB_VERSION_MINOR == 0
98-
::DrawRectangleRoundedLines(*this, roundness, segments, lineThick, color);
99-
#else
10093
DrawRectangleRoundedLinesEx(*this, roundness, segments, lineThick, color);
101-
#endif
10294
}
10395

10496
/**

0 commit comments

Comments
 (0)