Skip to content

Commit 3a6e7bb

Browse files
authored
Remove duplicate operator statements (#338)
* Remove duplicate operator statements * Make raylib not introduce the operators
1 parent 7b9fd03 commit 3a6e7bb

20 files changed

+51
-43
lines changed

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

include/AudioStream.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class AudioStream : public ::AudioStream {
8888
* Unload audio stream and free memory
8989
*/
9090
void Unload() {
91-
if (IsReady()) {
91+
if (IsValid()) {
9292
::UnloadAudioStream(*this);
9393
}
9494
}
@@ -182,7 +182,7 @@ class AudioStream : public ::AudioStream {
182182
/**
183183
* Retrieve whether or not the audio stream is ready.
184184
*/
185-
bool IsReady() const { return ::IsAudioStreamReady(*this); }
185+
bool IsValid() const { return ::IsAudioStreamValid(*this); }
186186

187187
/**
188188
* Load audio stream (to stream raw audio pcm data)
@@ -192,7 +192,7 @@ class AudioStream : public ::AudioStream {
192192
void Load(unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels = 2) {
193193
Unload();
194194
set(::LoadAudioStream(SampleRate, SampleSize, Channels));
195-
if (!IsReady()) {
195+
if (!IsValid()) {
196196
throw RaylibException("Failed to load audio stream");
197197
}
198198
}

include/AutomationEventList.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class AutomationEventList : public ::AutomationEventList {
7171
void Load(const char* fileName) {
7272
Unload();
7373
set(::LoadAutomationEventList(fileName));
74-
if (!IsReady()) {
74+
if (!IsValid()) {
7575
throw RaylibException("Failed to load automation event list");
7676
}
7777
}
@@ -80,7 +80,7 @@ class AutomationEventList : public ::AutomationEventList {
8080
* Update audio stream buffers with data
8181
*/
8282
void Unload() {
83-
if (!IsReady()) {
83+
if (!IsValid()) {
8484
return;
8585
}
8686

@@ -96,7 +96,7 @@ class AutomationEventList : public ::AutomationEventList {
9696
#endif
9797
}
9898

99-
bool IsReady() { return events != nullptr; }
99+
bool IsValid() { return events != nullptr; }
100100

101101
bool Export(const char* fileName) { return ::ExportAutomationEventList(*this, fileName); }
102102

include/Font.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class Font : public ::Font {
158158
*/
159159
void Load(const std::string& fileName) {
160160
set(::LoadFont(fileName.c_str()));
161-
if (!IsReady()) {
161+
if (!IsValid()) {
162162
throw RaylibException("Failed to load Font with from file: " + fileName);
163163
}
164164
}
@@ -175,14 +175,14 @@ class Font : public ::Font {
175175
*/
176176
void Load(const std::string& fileName, int fontSize, int* fontChars, int charCount) {
177177
set(::LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount));
178-
if (!IsReady()) {
178+
if (!IsValid()) {
179179
throw RaylibException("Failed to load Font with from file with font size: " + fileName);
180180
}
181181
}
182182

183183
void Load(const ::Image& image, ::Color key, int firstChar) {
184184
set(::LoadFontFromImage(image, key, firstChar));
185-
if (!IsReady()) {
185+
if (!IsValid()) {
186186
throw RaylibException("Failed to load Font with from image");
187187
}
188188
}
@@ -195,15 +195,15 @@ class Font : public ::Font {
195195
int* fontChars,
196196
int charsCount) {
197197
set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars, charsCount));
198-
if (!IsReady()) {
198+
if (!IsValid()) {
199199
throw RaylibException("Failed to load Font " + fileType + " with from file data");
200200
}
201201
}
202202

203203
/**
204204
* Returns if the font is ready to be used.
205205
*/
206-
bool IsReady() const { return ::IsFontReady(*this); }
206+
bool IsValid() const { return ::IsFontValid(*this); }
207207

208208
/**
209209
* Draw text using font and additional parameters.

include/Image.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class Image : public ::Image {
208208
*/
209209
void Load(const std::string& fileName) {
210210
set(::LoadImage(fileName.c_str()));
211-
if (!IsReady()) {
211+
if (!IsValid()) {
212212
throw RaylibException("Failed to load Image from file: " + fileName);
213213
}
214214
}
@@ -222,7 +222,7 @@ class Image : public ::Image {
222222
*/
223223
void Load(const std::string& fileName, int width, int height, int format, int headerSize) {
224224
set(::LoadImageRaw(fileName.c_str(), width, height, format, headerSize));
225-
if (!IsReady()) {
225+
if (!IsValid()) {
226226
throw RaylibException("Failed to load Image from file: " + fileName);
227227
}
228228
}
@@ -236,7 +236,7 @@ class Image : public ::Image {
236236
*/
237237
void Load(const std::string& fileName, int* frames) {
238238
set(::LoadImageAnim(fileName.c_str(), frames));
239-
if (!IsReady()) {
239+
if (!IsValid()) {
240240
throw RaylibException("Failed to load Image from file: " + fileName);
241241
}
242242
}
@@ -250,7 +250,7 @@ class Image : public ::Image {
250250
*/
251251
void Load(const std::string& fileType, const unsigned char* fileData, int dataSize) {
252252
set(::LoadImageFromMemory(fileType.c_str(), fileData, dataSize));
253-
if (!IsReady()) {
253+
if (!IsValid()) {
254254
throw RaylibException("Failed to load Image data with file type: " + fileType);
255255
}
256256
}
@@ -264,7 +264,7 @@ class Image : public ::Image {
264264
*/
265265
void Load(const ::Texture2D& texture) {
266266
set(::LoadImageFromTexture(texture));
267-
if (!IsReady()) {
267+
if (!IsValid()) {
268268
throw RaylibException("Failed to load Image from texture.");
269269
}
270270
}
@@ -728,7 +728,7 @@ class Image : public ::Image {
728728
*
729729
* @return True or false depending on whether the Image has been loaded.
730730
*/
731-
bool IsReady() const { return ::IsImageReady(*this); }
731+
bool IsValid() const { return ::IsImageValid(*this); }
732732
protected:
733733
void set(const ::Image& image) {
734734
data = image.data;

include/Material.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Material : public ::Material {
104104
/**
105105
* Check if material is ready
106106
*/
107-
bool IsReady() const { return ::IsMaterialReady(*this); }
107+
bool IsValid() const { return ::IsMaterialValid(*this); }
108108
protected:
109109
void set(const ::Material& material) {
110110
shader = material.shader;

include/MeshUnmanaged.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ class MeshUnmanaged : public ::Mesh {
210210
* Load model from generated mesh
211211
*/
212212
operator raylib::Model() { return ::LoadModelFromMesh(*this); }
213+
214+
/**
215+
* Returns whether or not the Mesh is valid.
216+
*/
217+
bool IsValid() { return ::IsModelValid(*this); }
218+
213219
protected:
214220
void set(const ::Mesh& mesh) {
215221
vertexCount = mesh.vertexCount;

include/Model.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class Model : public ::Model {
183183
/**
184184
* Determines whether or not the Model has data in it.
185185
*/
186-
bool IsReady() const { return ::IsModelReady(*this); }
186+
bool IsValid() const { return ::IsModelValid(*this); }
187187

188188
/**
189189
* Loads a Model from the given file.
@@ -192,7 +192,7 @@ class Model : public ::Model {
192192
*/
193193
void Load(const std::string& fileName) {
194194
set(::LoadModel(fileName.c_str()));
195-
if (!IsReady()) {
195+
if (!IsValid()) {
196196
throw RaylibException("Failed to load Model from " + fileName);
197197
}
198198
}
@@ -204,7 +204,7 @@ class Model : public ::Model {
204204
*/
205205
void Load(const ::Mesh& mesh) {
206206
set(::LoadModelFromMesh(mesh));
207-
if (!IsReady()) {
207+
if (!IsValid()) {
208208
throw RaylibException("Failed to load Model from Mesh");
209209
}
210210
}

include/Music.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class Music : public ::Music {
183183
*/
184184
void Load(const std::string& fileName) {
185185
set(::LoadMusicStream(fileName.c_str()));
186-
if (!IsReady()) {
186+
if (!IsValid()) {
187187
throw RaylibException(TextFormat("Failed to load Music from file: %s", fileName.c_str()));
188188
}
189189
}
@@ -195,7 +195,7 @@ class Music : public ::Music {
195195
*/
196196
void Load(const std::string& fileType, unsigned char* data, int dataSize) {
197197
set(::LoadMusicStreamFromMemory(fileType.c_str(), data, dataSize));
198-
if (!IsReady()) {
198+
if (!IsValid()) {
199199
throw RaylibException(TextFormat("Failed to load Music from %s file dat", fileType.c_str()));
200200
}
201201
}
@@ -205,7 +205,7 @@ class Music : public ::Music {
205205
*
206206
* @return True or false depending on whether the Music has been loaded.
207207
*/
208-
bool IsReady() const { return ::IsMusicReady(*this); }
208+
bool IsValid() const { return ::IsMusicValid(*this); }
209209
protected:
210210
void set(const ::Music& music) {
211211
stream = music.stream;

include/RenderTexture.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class RenderTexture : public ::RenderTexture {
103103
/**
104104
* Retrieves whether or not the render texture is ready.
105105
*/
106-
bool IsReady() const { return ::IsRenderTextureReady(*this); }
106+
bool IsValid() const { return ::IsRenderTextureValid(*this); }
107107
protected:
108108
void set(const ::RenderTexture& renderTexture) {
109109
id = renderTexture.id;

0 commit comments

Comments
 (0)