Skip to content

Commit 340117f

Browse files
committed
Updates for raylib 4.0.0
1 parent 1eab050 commit 340117f

File tree

10 files changed

+57
-19
lines changed

10 files changed

+57
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [x.x.x] - xxxx-xx-xx
99
### Changes
10+
- Update to raylib 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)

include/Functions.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,6 @@ RLCPPAPI inline void OpenURL(const std::string& url) {
189189
return ::OpenURL(url.c_str());
190190
}
191191

192-
/**
193-
* Check gamepad name (if available)
194-
*/
195-
RLCPPAPI inline bool IsGamepadName(int gamepad, const std::string& name) {
196-
return ::IsGamepadName(gamepad, name.c_str());
197-
}
198-
199192
/**
200193
* Update camera depending on selected mode
201194
*/

include/Gamepad.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ class Gamepad {
4545
return ::IsGamepadAvailable(number);
4646
}
4747

48-
/**
49-
* Check gamepad name (if available)
50-
*/
51-
inline bool IsName(const std::string& name) const {
52-
return ::IsGamepadName(number, name.c_str());
53-
}
54-
5548
/**
5649
* Return gamepad internal name id
5750
*/

include/Image.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class Image : public ::Image {
4242
set(::GenImageColor(width, height, color));
4343
}
4444

45+
Image(const std::string& text, int fontSize, ::Color color = {255, 255, 255, 255}) {
46+
set(::ImageText(text.c_str(), fontSize, color));
47+
}
48+
4549
Image(const ::Font& font, const std::string& text, float fontSize, float spacing,
4650
::Color tint = {255, 255, 255, 255}) {
4751
set(::ImageTextEx(font, text.c_str(), fontSize, spacing, tint));
@@ -279,6 +283,22 @@ class Image : public ::Image {
279283
return *this;
280284
}
281285

286+
/**
287+
* Clear alpha channel to desired color
288+
*/
289+
inline Image& AlphaClear(::Color color, float threshold) {
290+
::ImageAlphaClear(this, color, threshold);
291+
return *this;
292+
}
293+
294+
/**
295+
* Apply alpha mask to image
296+
*/
297+
inline Image& AlphaMask(::Color color, const ::Image& alphaMask) {
298+
::ImageAlphaMask(this, alphaMask);
299+
return *this;
300+
}
301+
282302
/**
283303
* Premultiply alpha channel
284304
*/

include/Mesh.hpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,23 @@ class Mesh : public ::Mesh {
1919
set(mesh);
2020
}
2121

22-
Mesh(int vertexCount, int triangleCount) : ::Mesh{vertexCount, triangleCount} {}
22+
Mesh(int vertexCount, int triangleCount) : ::Mesh{
23+
vertexCount,
24+
triangleCount,
25+
nullptr,
26+
nullptr,
27+
nullptr,
28+
nullptr,
29+
nullptr,
30+
nullptr,
31+
nullptr,
32+
nullptr,
33+
nullptr,
34+
nullptr,
35+
nullptr,
36+
0,
37+
nullptr
38+
} {}
2339

2440
/**
2541
* Load meshes from model file
@@ -133,7 +149,7 @@ class Mesh : public ::Mesh {
133149
GETTERSETTER(unsigned short *, Indices, indices) // NOLINT
134150
GETTERSETTER(float *, AnimVertices, animVertices)
135151
GETTERSETTER(float *, AnimNormals, animNormals)
136-
GETTERSETTER(int *, BoneIds, boneIds)
152+
GETTERSETTER(unsigned char *, BoneIds, boneIds)
137153
GETTERSETTER(float *, BoneWeights, boneWeights)
138154
GETTERSETTER(unsigned int, VaoId, vaoId)
139155
GETTERSETTER(unsigned int *, VboId, vboId)

include/Music.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ class Music : public ::Music {
126126
return *this;
127127
}
128128

129+
/**
130+
* Seek music to a position (in seconds)
131+
*/
132+
inline Music& Seek(float position) {
133+
SeekMusicStream(*this, position);
134+
return *this;
135+
}
136+
129137
/**
130138
* Check if music is playing
131139
*/

include/Texture.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ class Texture : public ::Texture {
255255
return *this;
256256
}
257257

258+
/**
259+
* Set texture and rectangle to be used on shapes drawing.
260+
*/
261+
inline Texture& SetShapes(const ::Rectangle& source) {
262+
::SetShapesTexture(*this, source);
263+
}
264+
258265
private:
259266
inline void set(const ::Texture& texture) {
260267
id = texture.id;

package.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": "3.7.0",
3+
"version": "4.0.0",
44
"description": "raylib-cpp: C++ Object-Oriented Wrapper for raylib",
55
"homepage": "https://github.com/robloach/raylib-cpp",
66
"bugs": {

projects/CMake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (NOT raylib_FOUND)
88
FetchContent_Declare(
99
raylib
1010
GIT_REPOSITORY https://github.com/raysan5/raylib.git
11-
GIT_TAG b6c8d343dca2ef19c23c50975328a028124cf3cb
11+
GIT_TAG 0851960397f02a477d80eda2239f90fae14dec64
1212
)
1313
FetchContent_GetProperties(raylib)
1414
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?

0 commit comments

Comments
 (0)