Skip to content

Commit 50602c7

Browse files
authored
Merge pull request #47 from RobLoach/update
Update
2 parents 699b1fc + f783c8d commit 50602c7

File tree

8 files changed

+77
-48
lines changed

8 files changed

+77
-48
lines changed

examples/textures/textures_image_drawing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int main(void)
4343
raylib::Font font("resources/custom_jupiter_crash.png");
4444

4545
// Draw over image using custom font
46-
parrots.DrawText(raylib::Vector2(300, 230), font, "PARROTS & CAT", font.baseSize, -2);
46+
parrots.DrawText(font, "PARROTS & CAT", raylib::Vector2(300, 230), font.baseSize, -2);
4747

4848
raylib::Texture2D texture(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
4949

include/Image.hpp

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,16 @@ namespace raylib {
2222
Image(const std::string& fileName) {
2323
Load(fileName);
2424
}
25-
Image(::Color* pixels, int width, int height) {
26-
LoadEx(pixels, width, height);
27-
}
28-
Image(void* data, int width, int height, int format) {
29-
LoadPro(data, width, height, format);
30-
}
3125
Image(const std::string& fileName, int width, int height, int format, int headerSize) {
3226
LoadRaw(fileName, width, height, format, headerSize);
3327
}
28+
Image(const std::string& fileName, int* frames) {
29+
LoadAnim(fileName, frames);
30+
}
3431
Image(::Texture2D texture) {
3532
set(::GetTextureData(texture));
3633
}
37-
Image(int width, int height, Color color = raylib::Color::RayWhite) {
34+
Image(int width, int height, Color color = WHITE) {
3835
set(::GenImageColor(width, height, color));
3936
}
4037

@@ -108,18 +105,14 @@ namespace raylib {
108105
set(::LoadImage(fileName.c_str()));
109106
}
110107

111-
void LoadEx(::Color* pixels, int width, int height) {
112-
set(::LoadImageEx(pixels, width, height));
113-
}
114-
115-
void LoadPro(void* data, int width, int height, int format) {
116-
set(::LoadImagePro(data, width, height, format));
117-
}
118-
119108
void LoadRaw(const std::string& fileName, int width, int height, int format, int headerSize) {
120109
set(::LoadImageRaw(fileName.c_str(), width, height, format, headerSize));
121110
}
122111

112+
void LoadAnim(const std::string& fileName, int* frames) {
113+
set(::LoadImageAnim(fileName.c_str(), frames));
114+
}
115+
123116
inline void Unload() {
124117
::UnloadImage(*this);
125118
};
@@ -238,8 +231,8 @@ namespace raylib {
238231
return *this;
239232
}
240233

241-
inline ::Color* ExtractPalette(int maxPaletteSize, int *extractCount) {
242-
return ::ImageExtractPalette(*this, maxPaletteSize, extractCount);
234+
inline ::Color* GetPalette(int maxPaletteSize, int *extractCount) {
235+
return ::GetImagePalette(*this, maxPaletteSize, extractCount);
243236
}
244237

245238
inline Rectangle GetAlphaBorder(float threshold) {
@@ -301,12 +294,16 @@ namespace raylib {
301294
return *this;
302295
}
303296

304-
inline Image& DrawText(::Vector2 position, const std::string& text, int fontSize, ::Color color = WHITE){
305-
::ImageDrawText(this, position, text.c_str(), fontSize, color);
297+
inline Image& DrawText(const std::string& text, ::Vector2 position, int fontSize, ::Color color = WHITE){
298+
::ImageDrawText(this, text.c_str(), (int)position.x, (int)position.y, fontSize, color);
299+
return *this;
300+
}
301+
inline Image& DrawText(const std::string& text, int x, int y, int fontSize, ::Color color = WHITE){
302+
::ImageDrawText(this, text.c_str(), x, y, fontSize, color);
306303
return *this;
307304
}
308-
inline Image& DrawText(::Vector2 position, ::Font font, const std::string& text, float fontSize, float spacing, ::Color color = WHITE){
309-
::ImageDrawTextEx(this, position, font, text.c_str(), fontSize, spacing, color);
305+
inline Image& DrawText(::Font font, const std::string& text, ::Vector2 position, float fontSize, float spacing, ::Color tint = WHITE){
306+
::ImageDrawTextEx(this, font, text.c_str(), position, fontSize, spacing, tint);
310307
return *this;
311308
}
312309

include/Music.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ namespace raylib {
2929
inline void set(::Music music) {
3030
ctxType = music.ctxType;
3131
ctxData = music.ctxData;
32+
looping = music.looping;
3233
sampleCount = music.sampleCount;
33-
loopCount = music.loopCount;
3434
stream = music.stream;
3535
}
3636

3737
GETTERSETTER(int,CtxType,ctxType)
38+
GETTERSETTER(bool,Looping,looping)
3839
GETTERSETTER(unsigned int,SampleCount,sampleCount)
39-
GETTERSETTER(unsigned int,LoopCount,loopCount)
4040

4141
Music& operator=(const ::Music& music) {
4242
set(music);
@@ -86,10 +86,6 @@ namespace raylib {
8686
::SetMusicPitch(*this, pitch);
8787
return *this;
8888
}
89-
inline Music& SetLoopCount(int count) {
90-
::SetMusicLoopCount(*this, count);
91-
return *this;
92-
}
9389
inline float GetTimeLength() {
9490
return ::GetMusicTimeLength(*this);
9591
}

include/Texture2D.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ namespace raylib {
7979
return *this;
8080
}
8181

82+
inline Texture2D& UpdateRec(Rectangle rec, const void *pixels) {
83+
UpdateTextureRec(*this, rec, pixels);
84+
return *this;
85+
}
86+
8287
inline Image GetTextureData() {
8388
return ::GetTextureData(*this);
8489
}
@@ -137,6 +142,11 @@ namespace raylib {
137142
return *this;
138143
}
139144

145+
inline Texture2D& DrawTiled(Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, float scale, Color tint = WHITE) {
146+
::DrawTextureTiled(*this, sourceRec, destRec, origin, rotation, scale, tint);
147+
return *this;
148+
}
149+
140150
inline Texture2D& SetMaterialTexture(Material *material, int mapType) {
141151
::SetMaterialTexture(material, mapType, *this);
142152
return *this;

include/Vector2.hpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ namespace raylib {
7777
}
7878

7979
Vector2 Multiply(const Vector2& vector2) {
80-
return Vector2MultiplyV(*this, vector2);
80+
return Vector2Multiply(*this, vector2);
8181
}
8282

8383
Vector2 operator*(const Vector2& vector2) {
84-
return Vector2MultiplyV(*this, vector2);
84+
return Vector2Multiply(*this, vector2);
8585
}
8686

8787
Vector2 Scale(const float scale) {
@@ -93,19 +93,25 @@ namespace raylib {
9393
}
9494

9595
Vector2 Divide(const Vector2& vector2) {
96-
return Vector2DivideV(*this, vector2);
96+
return Vector2Divide(*this, vector2);
9797
}
9898

9999
Vector2 operator/(const Vector2& vector2) {
100-
return Vector2DivideV(*this, vector2);
100+
return Vector2Divide(*this, vector2);
101101
}
102102

103-
Vector2 Divide(const float div) {
104-
return Vector2Divide(*this, div);
103+
Vector2& Divide(const float div) {
104+
x /= div;
105+
y /= div;
106+
107+
return *this;
105108
}
106109

107-
Vector2 operator/(const float div) {
108-
return Vector2Divide(*this, div);
110+
Vector2& operator/(const float div) {
111+
x /= div;
112+
y /= div;
113+
114+
return *this;
109115
}
110116

111117
Vector2& operator+=(const Vector2& vector2) {
@@ -122,7 +128,7 @@ namespace raylib {
122128

123129

124130
Vector2& operator*=(const Vector2& vector2) {
125-
set(Vector2MultiplyV(*this, vector2));
131+
set(Vector2Multiply(*this, vector2));
126132

127133
return *this;
128134
}
@@ -134,13 +140,14 @@ namespace raylib {
134140
}
135141

136142
Vector2& operator/=(const Vector2& vector2) {
137-
set(Vector2DivideV(*this, vector2));
143+
set(Vector2Divide(*this, vector2));
138144

139145
return *this;
140146
}
141147

142148
Vector2& operator/=(const float div) {
143-
set(Vector2Divide(*this, div));
149+
this->x /= div;
150+
this->y /= div;
144151

145152
return *this;
146153
}

include/Vector3.hpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,23 @@ namespace raylib {
100100
}
101101

102102
Vector3 Divide(const Vector3& vector3) {
103-
return Vector3DivideV(*this, vector3);
103+
return Vector3Divide(*this, vector3);
104104
}
105105

106106
Vector3 operator/(const Vector3& vector3) {
107-
return Vector3DivideV(*this, vector3);
107+
return Vector3Divide(*this, vector3);
108108
}
109109

110-
Vector3 Divide(const float div) {
111-
return Vector3Divide(*this, div);
110+
Vector3& Divide(const float div) {
111+
x /= div;
112+
y /= div;
113+
z /= div;
114+
115+
return *this;
112116
}
113117

114118
Vector3 operator/(const float div) {
115-
return Vector3Divide(*this, div);
119+
return Divide(div);
116120
}
117121

118122
Vector3& operator+=(const Vector3& vector3) {
@@ -141,13 +145,17 @@ namespace raylib {
141145
}
142146

143147
Vector3& operator/=(const Vector3& vector3) {
144-
set(Vector3DivideV(*this, vector3));
148+
x /= vector3.x;
149+
y /= vector3.y;
150+
z /= vector3.z;
145151

146152
return *this;
147153
}
148154

149155
Vector3& operator/=(const float div) {
150-
set(Vector3Divide(*this, div));
156+
x /= div;
157+
y /= div;
158+
z /= div;
151159

152160
return *this;
153161
}

include/Window.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ namespace raylib {
4848
::CloseWindow();
4949
};
5050

51+
inline bool IsCursorOnScreen() {
52+
return ::IsCursorOnScreen();
53+
}
54+
5155
/**
5256
* Check if window has been initialized successfully
5357
*/
@@ -57,6 +61,9 @@ namespace raylib {
5761
inline bool IsMinimized() {
5862
return ::IsWindowMinimized();
5963
}
64+
inline bool IsFocused() {
65+
return ::IsWindowFocused();
66+
}
6067
inline bool IsResized() {
6168
return ::IsWindowResized();
6269
}
@@ -124,10 +131,14 @@ namespace raylib {
124131
return ::GetScreenHeight();
125132
}
126133

127-
inline Vector2 GetWindowPosition() {
134+
inline Vector2 GetPosition() {
128135
return ::GetWindowPosition();
129136
}
130137

138+
inline Vector2 GetScaleDPI() {
139+
return ::GetWindowScaleDPI();
140+
}
141+
131142
std::string GetMonitorName(int monitor) {
132143
return std::string(::GetMonitorName(monitor));
133144
}

vendor/raylib

Submodule raylib updated 507 files

0 commit comments

Comments
 (0)