Skip to content

Commit 2cc804c

Browse files
Updated to work with raylib master
Working with commit raysan5/raylib@a1db022
1 parent 788b1af commit 2cc804c

19 files changed

+149
-162
lines changed

include/AudioStream.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AudioStream : public ::AudioStream {
1818
* Init audio stream (to stream raw audio pcm data)
1919
*/
2020
AudioStream(unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels = 2) {
21-
set(InitAudioStream(SampleRate, SampleSize, Channels));
21+
set(LoadAudioStream(SampleRate, SampleSize, Channels));
2222
}
2323

2424
AudioStream(const AudioStream&) = delete;
@@ -33,7 +33,7 @@ class AudioStream : public ::AudioStream {
3333
}
3434

3535
~AudioStream() {
36-
Close();
36+
Unload();
3737
}
3838

3939
GETTERSETTER(rAudioBuffer *, Buffer, buffer)
@@ -53,7 +53,7 @@ class AudioStream : public ::AudioStream {
5353
return *this;
5454
}
5555

56-
Close();
56+
Unload();
5757
set(other);
5858

5959
other.buffer = nullptr;
@@ -73,10 +73,10 @@ class AudioStream : public ::AudioStream {
7373
}
7474

7575
/**
76-
* Close audio stream and free memory
76+
* Unload audio stream and free memory
7777
*/
78-
inline void Close() {
79-
::CloseAudioStream(*this);
78+
inline void Unload() {
79+
::UnloadAudioStream(*this);
8080
}
8181

8282
/**

include/BoundingBox.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BoundingBox : public ::BoundingBox {
1818
* Compute mesh bounding box limits
1919
*/
2020
BoundingBox(const ::Mesh& mesh) {
21-
set(::MeshBoundingBox(mesh));
21+
set(::GetMeshBoundingBox(mesh));
2222
}
2323

2424
BoundingBox(::Vector3 minMax) : ::BoundingBox{minMax, minMax} {}
@@ -58,7 +58,14 @@ class BoundingBox : public ::BoundingBox {
5858
* Detect collision between ray and bounding box
5959
*/
6060
inline bool CheckCollision(const ::Ray& ray) const {
61-
return CheckCollisionRayBox(ray, *this);
61+
return GetRayCollisionBox(ray, *this).hit;
62+
}
63+
64+
/**
65+
* Get collision information between ray and bounding box
66+
*/
67+
inline RayCollision GetCollision(const ::Ray& ray) const {
68+
return GetRayCollisionBox(ray, *this);
6269
}
6370

6471
private:

include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ install(FILES
2525
physac.hpp
2626
Physics.hpp
2727
Ray.hpp
28-
RayHitInfo.hpp
28+
RayCollision.hpp
2929
raylib-cpp-utils.hpp
3030
raylib-cpp.hpp
3131
raylib.hpp

include/Camera3D.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class Camera3D : public ::Camera3D {
143143
const ::Texture2D& texture,
144144
::Rectangle sourceRec,
145145
::Vector3 center,
146-
float size,
146+
::Vector2 size,
147147
::Color tint = {255, 255, 255, 255}) {
148148
::DrawBillboardRec(*this, texture, sourceRec, center, size, tint);
149149
return *this;

include/Color.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,14 @@ class Color : public ::Color {
163163
}
164164

165165
inline Color& DrawText(
166-
const ::Font& font,
166+
const ::Font font,
167167
const std::string& text,
168-
::Rectangle rec,
168+
::Vector2 position,
169+
::Vector2 origin,
170+
float rotation,
169171
float fontSize,
170-
float spacing,
171-
bool wordWrap = false) {
172-
::DrawTextRec(font, text.c_str(), rec, fontSize, spacing, wordWrap, *this);
172+
float spacing) {
173+
::DrawTextPro(font, text.c_str(), position, origin, rotation, fontSize, spacing, *this);
173174
return *this;
174175
}
175176

include/Font.hpp

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ class Font : public ::Font {
4444
set(other);
4545

4646
other.baseSize = 0;
47-
other.charsCount = 0;
48-
other.charsPadding = 0;
47+
other.glyphCount = 0;
48+
other.glyphPadding = 0;
4949
other.texture = { 0 };
5050
other.recs = nullptr;
51-
other.chars = nullptr;
51+
other.glyphs = nullptr;
5252
}
5353

5454
~Font() {
@@ -60,11 +60,11 @@ class Font : public ::Font {
6060
}
6161

6262
GETTERSETTER(int, BaseSize, baseSize)
63-
GETTERSETTER(int, CharsCount, charsCount)
64-
GETTERSETTER(int, CharsPadding, charsPadding)
63+
GETTERSETTER(int, GlyphCount, glyphCount)
64+
GETTERSETTER(int, GlyphPadding, glyphPadding)
6565
GETTERSETTER(::Texture2D, Texture, texture)
6666
GETTERSETTER(::Rectangle*, Recs, recs)
67-
GETTERSETTER(::CharInfo*, Chars, chars)
67+
GETTERSETTER(::GlyphInfo*, Glyphs, glyphs)
6868

6969
Font& operator=(const ::Font& font) {
7070
set(font);
@@ -82,11 +82,11 @@ class Font : public ::Font {
8282
set(other);
8383

8484
other.baseSize = 0;
85-
other.charsCount = 0;
86-
other.charsPadding = 0;
85+
other.glyphCount = 0;
86+
other.glyphPadding = 0;
8787
other.texture = { 0 };
8888
other.recs = nullptr;
89-
other.chars = nullptr;
89+
other.glyphs = nullptr;
9090

9191
return *this;
9292
}
@@ -100,20 +100,15 @@ class Font : public ::Font {
100100
return *this;
101101
}
102102

103-
inline Font& DrawText(const std::string& text, ::Rectangle rec, float fontSize, float spacing,
104-
bool wordWrap = false, ::Color tint = WHITE) {
105-
::DrawTextRec(*this, text.c_str(), rec, fontSize, spacing, wordWrap, tint);
106-
return *this;
107-
}
108-
109-
/**
110-
* Draw text using font inside rectangle limits with support for text selection.
111-
*/
112-
inline Font& DrawText(const std::string& text, ::Rectangle rec, float fontSize, float spacing,
113-
bool wordWrap, ::Color tint, int selectStart, int selectLength, ::Color selectText,
114-
::Color selectBack) {
115-
::DrawTextRecEx(*this, text.c_str(), rec, fontSize, spacing, wordWrap, tint,
116-
selectStart, selectLength, selectText, selectBack);
103+
inline Font& DrawText(
104+
const std::string& text,
105+
::Vector2 position,
106+
::Vector2 origin,
107+
float rotation,
108+
float fontSize,
109+
float spacing,
110+
::Color tint = WHITE) {
111+
::DrawTextPro(*this, text.c_str(), position, origin, rotation, fontSize, spacing, tint);
117112
return *this;
118113
}
119114

@@ -153,11 +148,11 @@ class Font : public ::Font {
153148
private:
154149
void set(const ::Font& font) {
155150
baseSize = font.baseSize;
156-
charsCount = font.charsCount;
157-
charsPadding = font.charsPadding;
151+
glyphCount = font.glyphCount;
152+
glyphPadding = font.glyphPadding;
158153
texture = font.texture;
159154
recs = font.recs;
160-
chars = font.chars;
155+
glyphs = font.glyphs;
161156
}
162157
};
163158
} // namespace raylib

include/Functions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ RLCPPAPI inline void TakeScreenshot(const std::string& fileName) {
6767
RLCPPAPI std::string LoadFileText(const std::string& fileName) {
6868
char* text = ::LoadFileText(fileName.c_str());
6969
std::string output(text);
70-
::UnloadFileText((unsigned char*)text);
70+
::UnloadFileText(text);
7171
return output;
7272
}
7373

include/Image.hpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Image : public ::Image {
3535
}
3636

3737
Image(const ::Texture2D& texture) {
38-
set(::GetTextureData(texture));
38+
set(::LoadImageFromTexture(texture));
3939
}
4040

4141
Image(int width, int height, ::Color color = {255, 255, 255, 255}) {
@@ -74,8 +74,8 @@ class Image : public ::Image {
7474
/**
7575
* Get pixel data from screen buffer and return an Image (screenshot)
7676
*/
77-
static ::Image GetScreenData() {
78-
return ::GetScreenData();
77+
static ::Image LoadFromScreen() {
78+
return ::LoadImageFromScreen();
7979
}
8080

8181
/**
@@ -122,14 +122,6 @@ class Image : public ::Image {
122122
return ::GenImageWhiteNoise(width, height, factor);
123123
}
124124

125-
/**
126-
* Generate image: perlin noise
127-
*/
128-
static ::Image PerlinNoise(int width, int height, int offsetX, int offsetY,
129-
float scale = 1.0f) {
130-
return ::GenImagePerlinNoise(width, height, offsetX, offsetY, scale);
131-
}
132-
133125
/**
134126
* Generate image: cellular algorithm. Bigger tileSize means bigger cells
135127
*/

include/Mesh.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class Mesh : public ::Mesh {
220220
* Compute mesh bounding box limits
221221
*/
222222
inline raylib::BoundingBox BoundingBox() const {
223-
return ::MeshBoundingBox(*this);
223+
return ::GetMeshBoundingBox(*this);
224224
}
225225

226226
/**
@@ -234,15 +234,15 @@ class Mesh : public ::Mesh {
234234
* Compute mesh tangents
235235
*/
236236
inline Mesh& Tangents() {
237-
::MeshTangents(this);
237+
::GenMeshTangents(this);
238238
return *this;
239239
}
240240

241241
/**
242242
* Compute mesh binormals (aka bitangent)
243243
*/
244244
inline Mesh& Binormals() {
245-
::MeshBinormals(this);
245+
::GenMeshBinormals(this);
246246
return *this;
247247
}
248248

include/Model.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ class Model : public ::Model {
109109
/**
110110
* Get collision info between ray and model
111111
*/
112-
inline RayHitInfo GetCollision(const ::Ray& ray) const {
113-
return ::GetCollisionRayModel(ray, *this);
112+
inline RayCollision GetCollision(const ::Ray& ray) const {
113+
return ::GetRayCollisionModel(ray, *this);
114114
}
115115

116116
/**

0 commit comments

Comments
 (0)