Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bd637c2
Fixed references to boneCount, bones, bindPose to reflect access to M…
execphantasmagoria Mar 1, 2026
2bbd53d
Updated method UpdateModelAnimationBones() to UpdateModelAnimationEx(…
execphantasmagoria Mar 3, 2026
9ce142d
Updated boneId to boneIndices, relocated boneMatrices from Mesh to Mo…
execphantasmagoria Mar 3, 2026
1749440
Updated boneId to boneIndices in Mesh.hpp
execphantasmagoria Mar 3, 2026
a417182
Updated ModelAnimation frameCount and framePoses to keyframeCount and…
execphantasmagoria Mar 3, 2026
ad07197
Fixed UnloadModelAnimation() to use a count
execphantasmagoria Mar 3, 2026
fd98a5e
Fixed UpdateBones() to use UpdateModelAnimationsEx() instead
execphantasmagoria Mar 3, 2026
4e3a5ea
Fixed: Reverted UpdateModelAnimationEx() to UpdateModelAnimation(). C…
execphantasmagoria Mar 3, 2026
3cfa3db
Update raylib version targeting for 6
RobLoach Mar 3, 2026
0041e29
Updated Multiply() operator* to enable MatrixMultiplyValue()
execphantasmagoria Mar 5, 2026
d4cf1eb
Fixed: ModelAnimation now has attribute animCount which is used to lo…
execphantasmagoria Mar 5, 2026
d945e03
Updated Unload() to check if animCount is 0 before unloading.
execphantasmagoria Mar 5, 2026
7f2178b
Reverted adding animCount as member variable. Unload() only unloads o…
execphantasmagoria Mar 5, 2026
0847ecf
Renamed UpdateModelAnimationEx() in Model.hpp to BlendAnimation()
execphantasmagoria Mar 5, 2026
355dfce
Updated Unload() to overload with animCount
execphantasmagoria Mar 6, 2026
e331ebf
Added UnloadAnimations() as a static method
execphantasmagoria Mar 6, 2026
c674194
Renamed UnloadAnimations to Unload for consistency
execphantasmagoria Mar 6, 2026
7eb898f
Merge pull request #380 from execphantasmagoria/next
RobLoach Mar 24, 2026
d47073a
Merge branch 'master' of github.com:RobLoach/raylib-cpp into next
RobLoach Mar 30, 2026
e9b6651
Merge branch 'next' of github.com:RobLoach/raylib-cpp into next
RobLoach Mar 30, 2026
537767a
Update raylib
RobLoach Mar 30, 2026
f770631
Update to raylib 6.0 tag, fix crashes
RobLoach Apr 23, 2026
a12c468
Update version to 6.0.0
RobLoach Apr 23, 2026
c3061ca
Add TextToSnake and TextToCamel wrappers
RobLoach Apr 23, 2026
8db2f38
Fix Functions.hpp bugs and add missing wrappers
RobLoach Apr 23, 2026
5ce406b
Fix bugs across Wave, Rectangle, Mesh, Font
RobLoach Apr 23, 2026
08e89f9
Fix GetDirectoryFiles -> LoadDirectoryFiles in README
RobLoach Apr 23, 2026
5f79e12
rectangle: Fix Rectangle Draw function parameter order
RobLoach Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
cmake-build-debug
.idea
docs
/.vs
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.11)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project (raylib_cpp
VERSION 5.5.1
VERSION 6.0.0
DESCRIPTION "raylib-cpp C++ Object Oriented Wrapper for raylib"
HOMEPAGE_URL "https://github.com/robloach/raylib-cpp"
LANGUAGES C CXX
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![raylib-cpp Logo](projects/Doxygen/raylib-cpp_256x256.png)

# raylib-cpp ![Targeting raylib 5.0](https://img.shields.io/badge/for_raylib-5.0-blue) [![Tests](https://github.com/RobLoach/raylib-cpp/workflows/Tests/badge.svg)](https://github.com/RobLoach/raylib-cpp/actions?query=workflow%3ATests+branch%3Amaster) [![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE)
# raylib-cpp ![Targeting raylib 6](https://img.shields.io/badge/for_raylib-6-blue) [![Tests](https://github.com/RobLoach/raylib-cpp/workflows/Tests/badge.svg)](https://github.com/RobLoach/raylib-cpp/actions?query=workflow%3ATests+branch%3Amaster) [![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE)

[raylib-cpp](https://github.com/robloach/raylib-cpp) is a C++ wrapper library for [raylib](https://www.raylib.com), a simple and easy-to-use library to enjoy videogames programming. This C++ header provides object-oriented wrappers around *raylib*'s struct interfaces. *raylib-cpp* is not required to use *raylib* in C++, but the classes do bring using the raylib API more inline with C++'s language paradigm.

Expand Down Expand Up @@ -198,7 +198,7 @@ for (int i = 0; i < files.count; i++) {
UnloadDirectoryFiles(files);

// raylib-cpp
std::vector<std::string> files = raylib::GetDirectoryFiles(".");
std::vector<std::string> files = raylib::LoadDirectoryFiles(".");
TraceLog(LOG_INFO, "Count: %i", files.size());
for (auto& file : files) {
TraceLog(LOG_INFO, "File: %s", file.c_str());
Expand Down
2 changes: 1 addition & 1 deletion clib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "raylib-cpp",
"version": "5.5.1",
"version": "6.0.0",
"repo": "RobLoach/raylib-cpp",
"description": "raylib-cpp: C++ Object-Oriented Wrapper for raylib",
"homepage": "https://github.com/robloach/raylib-cpp",
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (NOT raylib_FOUND)
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 5.5
GIT_TAG 6.0
GIT_SHALLOW 1
)
FetchContent_GetProperties(raylib)
Expand Down
20 changes: 10 additions & 10 deletions include/Font.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Font : public ::Font {
*
* @see ::LoadFontEx
*/
Font(const std::string& fileName, int fontSize, int* fontChars = 0, int charCount = 0) {
Load(fileName, fontSize, fontChars, charCount);
Font(const std::string& fileName, int fontSize, const int* codepoints = nullptr, int codepointCount = 0) {
Load(fileName, fontSize, codepoints, codepointCount);
}

/**
Expand All @@ -77,9 +77,9 @@ class Font : public ::Font {
const unsigned char* fileData,
int dataSize,
int fontSize,
int* fontChars,
int charsCount) {
Load(fileType, fileData, dataSize, fontSize, fontChars, charsCount);
const int* codepoints,
int codepointCount) {
Load(fileType, fileData, dataSize, fontSize, codepoints, codepointCount);
}

Font(const Font&) = delete;
Expand Down Expand Up @@ -173,8 +173,8 @@ class Font : public ::Font {
*
* @see ::LoadFontEx()
*/
void Load(const std::string& fileName, int fontSize, int* fontChars, int charCount) {
set(::LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount));
void Load(const std::string& fileName, int fontSize, const int* codepoints = nullptr, int codepointCount = 0) {
set(::LoadFontEx(fileName.c_str(), fontSize, codepoints, codepointCount));
if (!IsValid()) {
throw RaylibException("Failed to load Font with from file with font size: " + fileName);
}
Expand All @@ -192,9 +192,9 @@ class Font : public ::Font {
const unsigned char* fileData,
int dataSize,
int fontSize,
int* fontChars,
int charsCount) {
set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars, charsCount));
const int* codepoints,
int codepointCount) {
set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, codepoints, codepointCount));
if (!IsValid()) {
throw RaylibException("Failed to load Font " + fileType + " with from file data");
}
Expand Down
59 changes: 43 additions & 16 deletions include/Functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace raylib {
* Save text data to file (write)
*/
[[maybe_unused]] RLCPPAPI inline bool SaveFileText(const std::string& fileName, const std::string& text) {
return ::SaveFileText(fileName.c_str(), const_cast<char*>(text.c_str()));
return ::SaveFileText(fileName.c_str(), text.c_str());
}

/**
Expand Down Expand Up @@ -157,6 +157,17 @@ namespace raylib {
return output;
}

/**
* Load directory filepaths with extension filtering and optional subdirectory scanning
*/
[[maybe_unused]] RLCPPAPI std::vector<std::string>
LoadDirectoryFilesEx(const std::string& basePath, const std::string& filter, bool scanSubdirs = false) {
FilePathList files = ::LoadDirectoryFilesEx(basePath.c_str(), filter.c_str(), scanSubdirs);
std::vector<std::string> output(files.paths, files.paths + files.count);
::UnloadDirectoryFiles(files);
return output;
}

/**
* Change working directory, return true on success
*/
Expand Down Expand Up @@ -254,7 +265,7 @@ DrawText(const std::string& text, int posX, int posY, int fontSize, ::Color colo
* Draw text using font and additional parameters
*/
[[maybe_unused]] RLCPPAPI inline void
DrawTextEx(const Font& font, char* text, Vector2 position, float fontSize, float spacing, ::Color tint) {
DrawTextEx(const Font& font, const char* text, Vector2 position, float fontSize, float spacing, ::Color tint) {
::DrawTextEx(font, text, position, fontSize, spacing, tint);
}

Expand Down Expand Up @@ -307,8 +318,8 @@ DrawTextEx(const Font& font, const std::string& text, Vector2 position, float fo
* Load font from file (filename must include file extension)
*/
[[maybe_unused]] RLCPPAPI inline ::Font
LoadFontEx(const std::string& fileName, int fontSize, int* fontChars, int charsCount) {
return ::LoadFontEx(fileName.c_str(), fontSize, fontChars, charsCount);
LoadFontEx(const std::string& fileName, int fontSize, const int* codepoints = nullptr, int codepointCount = 0) {
return ::LoadFontEx(fileName.c_str(), fontSize, codepoints, codepointCount);
}

/**
Expand Down Expand Up @@ -340,21 +351,21 @@ LoadFontEx(const std::string& fileName, int fontSize, int* fontChars, int charsC
}

/**
* Check if two text string are equal
* Get text length, checks for '\0' ending
*/
[[maybe_unused]] RLCPPAPI inline unsigned int TextLength(const char* text) {
return ::TextLength(text);
}

/**
* Check if two text string are equal
* Get text length, checks for '\0' ending
*/
[[maybe_unused]] RLCPPAPI inline unsigned int TextLength(const std::string& text) {
return ::TextLength(text.c_str());
}

/**
* Get text length, checks for '\0' ending
* Get a piece of a text string
*/
[[maybe_unused]] RLCPPAPI inline std::string TextSubtext(const std::string& text, int position, int length) {
return ::TextSubtext(text.c_str(), position, length);
Expand All @@ -365,12 +376,9 @@ LoadFontEx(const std::string& fileName, int fontSize, int* fontChars, int charsC
*/
[[maybe_unused]] RLCPPAPI std::string
TextReplace(const std::string& text, const std::string& replace, const std::string& by) {
const char* input = text.c_str();
char* output = ::TextReplace(const_cast<char*>(input), replace.c_str(), by.c_str());
const char* output = ::TextReplace(text.c_str(), replace.c_str(), by.c_str());
if (output != NULL) {
std::string stringOutput(output);
free(output);
return stringOutput;
return std::string(output);
}
return "";
}
Expand All @@ -379,11 +387,9 @@ TextReplace(const std::string& text, const std::string& replace, const std::stri
* Insert text in a position
*/
[[maybe_unused]] RLCPPAPI std::string TextInsert(const std::string& text, const std::string& insert, int position) {
char* output = ::TextInsert(text.c_str(), insert.c_str(), position);
const char* output = ::TextInsert(text.c_str(), insert.c_str(), position);
if (output != NULL) {
std::string stringOutput(output);
free(output);
return stringOutput;
return std::string(output);
}
return "";
}
Expand Down Expand Up @@ -425,13 +431,34 @@ TextReplace(const std::string& text, const std::string& replace, const std::stri
return ::TextToPascal(text.c_str());
}

/**
* Get Snake case notation version of provided string
*/
[[maybe_unused]] RLCPPAPI inline std::string TextToSnake(const std::string& text) {
return ::TextToSnake(text.c_str());
}

/**
* Get Camel case notation version of provided string
*/
[[maybe_unused]] RLCPPAPI inline std::string TextToCamel(const std::string& text) {
return ::TextToCamel(text.c_str());
}

/**
* Get integer value from text (negative values not supported)
*/
[[maybe_unused]] RLCPPAPI inline int TextToInteger(const std::string& text) {
return ::TextToInteger(text.c_str());
}

/**
* Get float value from text
*/
[[maybe_unused]] RLCPPAPI inline float TextToFloat(const std::string& text) {
return ::TextToFloat(text.c_str());
}

} // namespace raylib

#endif // RAYLIB_CPP_INCLUDE_FUNCTIONS_HPP_
4 changes: 4 additions & 0 deletions include/Matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ class Matrix : public ::Matrix {

[[nodiscard]] Matrix Multiply(const ::Matrix& right) const { return ::MatrixMultiply(*this, right); }

[[nodiscard]] Matrix Multiply(float value) const { return ::MatrixMultiplyValue(*this, value); }

Matrix operator*(const ::Matrix& matrix) { return ::MatrixMultiply(*this, matrix); }

Matrix operator*(float value) { return ::MatrixMultiplyValue(*this, value); }

static Matrix Frustum(double left, double right, double bottom, double top, double near, double far) {
return ::MatrixFrustum(left, right, bottom, top, near, far);
}
Expand Down
4 changes: 2 additions & 2 deletions include/Mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Mesh : public MeshUnmanaged {
other.indices = nullptr;
other.animVertices = nullptr;
other.animNormals = nullptr;
other.boneIds = nullptr;
other.boneIndices = nullptr;
other.boneWeights = nullptr;
other.vaoId = 0;
other.vboId = nullptr;
Expand All @@ -73,7 +73,7 @@ class Mesh : public MeshUnmanaged {
other.indices = nullptr;
other.animVertices = nullptr;
other.animNormals = nullptr;
other.boneIds = nullptr;
other.boneIndices = nullptr;
other.boneWeights = nullptr;
other.vaoId = 0;
other.vboId = nullptr;
Expand Down
12 changes: 5 additions & 7 deletions include/MeshUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ class MeshUnmanaged : public ::Mesh {
indices = nullptr;
animVertices = nullptr;
animNormals = nullptr;
boneIds = nullptr;
boneIndices = nullptr;
boneWeights = nullptr;
boneMatrices = nullptr;
boneCount = 0;
vaoId = 0;
vboId = nullptr;
Expand Down Expand Up @@ -130,7 +129,7 @@ class MeshUnmanaged : public ::Mesh {
GETTERSETTER(unsigned short*, Indices, indices) // NOLINT
GETTERSETTER(float*, AnimVertices, animVertices)
GETTERSETTER(float*, AnimNormals, animNormals)
GETTERSETTER(unsigned char*, BoneIds, boneIds)
GETTERSETTER(unsigned char*, BoneIndices, boneIndices)
GETTERSETTER(float*, BoneWeights, boneWeights)
GETTERSETTER(unsigned int, VaoId, vaoId)
GETTERSETTER(unsigned int*, VboId, vboId)
Expand Down Expand Up @@ -170,7 +169,7 @@ class MeshUnmanaged : public ::Mesh {
/**
* Draw multiple mesh instances with material and different transforms
*/
void Draw(const ::Material& material, ::Matrix* transforms, int instances) const {
void Draw(const ::Material& material, const ::Matrix* transforms, int instances) const {
::DrawMeshInstanced(*this, material, transforms, instances);
}

Expand Down Expand Up @@ -227,7 +226,7 @@ class MeshUnmanaged : public ::Mesh {
/**
* Returns whether or not the Mesh is valid.
*/
bool IsValid() { return ::IsModelValid(*this); }
[[nodiscard]] bool IsValid() const { return vaoId != 0 && vertexCount > 0; }

protected:
void set(const ::Mesh& mesh) {
Expand All @@ -242,9 +241,8 @@ class MeshUnmanaged : public ::Mesh {
indices = mesh.indices;
animVertices = mesh.animVertices;
animNormals = mesh.animNormals;
boneIds = mesh.boneIds;
boneIndices = mesh.boneIndices;
boneWeights = mesh.boneWeights;
boneMatrices = mesh.boneMatrices;
vaoId = mesh.vaoId;
vboId = mesh.vboId;
}
Expand Down
Loading
Loading