Skip to content

Commit 5ce406b

Browse files
committed
Fix bugs across Wave, Rectangle, Mesh, Font
1 parent 8db2f38 commit 5ce406b

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎include/Font.hpp‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class Font : public ::Font {
5050
*
5151
* @see ::LoadFontEx
5252
*/
53-
Font(const std::string& fileName, int fontSize, int* fontChars = 0, int charCount = 0) {
54-
Load(fileName, fontSize, fontChars, charCount);
53+
Font(const std::string& fileName, int fontSize, const int* codepoints = nullptr, int codepointCount = 0) {
54+
Load(fileName, fontSize, codepoints, codepointCount);
5555
}
5656

5757
/**
@@ -77,9 +77,9 @@ class Font : public ::Font {
7777
const unsigned char* fileData,
7878
int dataSize,
7979
int fontSize,
80-
int* fontChars,
81-
int charsCount) {
82-
Load(fileType, fileData, dataSize, fontSize, fontChars, charsCount);
80+
const int* codepoints,
81+
int codepointCount) {
82+
Load(fileType, fileData, dataSize, fontSize, codepoints, codepointCount);
8383
}
8484

8585
Font(const Font&) = delete;
@@ -173,8 +173,8 @@ class Font : public ::Font {
173173
*
174174
* @see ::LoadFontEx()
175175
*/
176-
void Load(const std::string& fileName, int fontSize, int* fontChars, int charCount) {
177-
set(::LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount));
176+
void Load(const std::string& fileName, int fontSize, const int* codepoints = nullptr, int codepointCount = 0) {
177+
set(::LoadFontEx(fileName.c_str(), fontSize, codepoints, codepointCount));
178178
if (!IsValid()) {
179179
throw RaylibException("Failed to load Font with from file with font size: " + fileName);
180180
}
@@ -192,9 +192,9 @@ class Font : public ::Font {
192192
const unsigned char* fileData,
193193
int dataSize,
194194
int fontSize,
195-
int* fontChars,
196-
int charsCount) {
197-
set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars, charsCount));
195+
const int* codepoints,
196+
int codepointCount) {
197+
set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, codepoints, codepointCount));
198198
if (!IsValid()) {
199199
throw RaylibException("Failed to load Font " + fileType + " with from file data");
200200
}

‎include/MeshUnmanaged.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class MeshUnmanaged : public ::Mesh {
169169
/**
170170
* Draw multiple mesh instances with material and different transforms
171171
*/
172-
void Draw(const ::Material& material, ::Matrix* transforms, int instances) const {
172+
void Draw(const ::Material& material, const ::Matrix* transforms, int instances) const {
173173
::DrawMeshInstanced(*this, material, transforms, instances);
174174
}
175175

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

231231
protected:
232232
void set(const ::Mesh& mesh) {

‎include/Rectangle.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Rectangle : public ::Rectangle {
9090
}
9191

9292
void DrawRoundedLines(float roundness, int segments, float lineThick, ::Color color) const {
93-
DrawRectangleRoundedLinesEx(*this, roundness, segments, lineThick, color);
93+
::DrawRectangleRoundedLinesEx(*this, roundness, segments, lineThick, color);
9494
}
9595

9696
/**

‎include/Wave.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Wave : public ::Wave {
8181
}
8282

8383
Wave& operator=(Wave&& other) noexcept {
84-
if (this != &other) {
84+
if (this == &other) {
8585
return *this;
8686
}
8787

0 commit comments

Comments
 (0)