diff --git a/include/AudioStream.hpp b/include/AudioStream.hpp index ded18ed..449f937 100644 --- a/include/AudioStream.hpp +++ b/include/AudioStream.hpp @@ -144,9 +144,8 @@ class AudioStream : public ::AudioStream { /** * Default size for new audio streams */ - inline AudioStream& SetBufferSizeDefault(int size) { + inline static void SetBufferSizeDefault(int size) { ::SetAudioStreamBufferSizeDefault(size); - return *this; } protected: diff --git a/include/Camera2D.hpp b/include/Camera2D.hpp index 3756717..6817154 100644 --- a/include/Camera2D.hpp +++ b/include/Camera2D.hpp @@ -67,9 +67,11 @@ class Camera2D : public ::Camera2D { inline Matrix GetMatrix() const { return ::GetCameraMatrix2D(*this); } + inline Vector2 GetWorldToScreen2D(Vector2 position) const { return ::GetWorldToScreen2D(position, *this); } + inline Vector2 GetScreenToWorld2D(Vector2 position) const { return ::GetScreenToWorld2D(position, *this); } diff --git a/include/Color.hpp b/include/Color.hpp index a29272f..8e420b0 100644 --- a/include/Color.hpp +++ b/include/Color.hpp @@ -145,18 +145,22 @@ class Color : public ::Color { ::DrawLine(startPosX, startPosY, endPosX, endPosY, *this); return *this; } + inline Color& DrawLine(::Vector2 startPos, ::Vector2 endPos) { ::DrawLineV(startPos, endPos, *this); return *this; } + inline Color& DrawLine(::Vector2 startPos, ::Vector2 endPos, float thick) { ::DrawLineEx(startPos, endPos, thick, *this); return *this; } + inline Color& DrawLineBezier(::Vector2 startPos, Vector2 endPos, float thick) { ::DrawLineBezier(startPos, endPos, thick, *this); return *this; } + inline Color& DrawLineStrip(::Vector2 *points, int numPoints) { ::DrawLineStrip(points, numPoints, *this); return *this; @@ -166,6 +170,7 @@ class Color : public ::Color { ::DrawText(text.c_str(), posX, posY, fontSize, *this); return *this; } + inline Color& DrawText(::Font font, const std::string& text, ::Vector2 position, float fontSize, float spacing) { ::DrawTextEx(font, text.c_str(), position, fontSize, spacing, *this); diff --git a/include/Font.hpp b/include/Font.hpp index d5cf6b9..1306e81 100644 --- a/include/Font.hpp +++ b/include/Font.hpp @@ -84,11 +84,13 @@ class Font : public ::Font { ::DrawTextEx(*this, text.c_str(), position, fontSize, spacing, tint); return *this; } + inline Font& DrawText(const std::string& text, ::Rectangle rec, float fontSize, float spacing, bool wordWrap, ::Color tint = WHITE) { ::DrawTextRec(*this, text.c_str(), rec, fontSize, spacing, wordWrap, tint); return *this; } + inline Font& DrawText(const std::string& text, ::Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, ::Color selectText, Color selectBack) { diff --git a/include/Gamepad.hpp b/include/Gamepad.hpp index 8befc8a..23c8a8e 100644 --- a/include/Gamepad.hpp +++ b/include/Gamepad.hpp @@ -72,6 +72,7 @@ class Gamepad { inline bool IsButtonReleased(int button) const { return ::IsGamepadButtonReleased(number, button); } + inline bool IsButtonUp(int button) const { return ::IsGamepadButtonUp(number, button); } diff --git a/include/Image.hpp b/include/Image.hpp index 0a2f047..b38d271 100644 --- a/include/Image.hpp +++ b/include/Image.hpp @@ -195,6 +195,7 @@ class Image : public ::Image { ::ImageResize(this, newWidth, newHeight); return *this; } + inline Image& ResizeNN(int newWidth, int newHeight) { ::ImageResizeNN(this, newWidth, newHeight); return *this; @@ -303,22 +304,27 @@ class Image : public ::Image { ::ImageDrawCircleV(this, center, radius, color); return *this; } + inline Image& DrawRectangle(int posX, int posY, int width, int height, ::Color color = WHITE) { ::ImageDrawRectangle(this, posX, posY, width, height, color); return *this; } + inline Image& DrawRectangle(Vector2 position, Vector2 size, ::Color color = WHITE) { ::ImageDrawRectangleV(this, position, size, color); return *this; } + inline Image& DrawRectangle(::Rectangle rec, ::Color color = WHITE) { ::ImageDrawRectangleRec(this, rec, color); return *this; } + inline Image& DrawRectangleLines(::Rectangle rec, int thick, ::Color color) { ::ImageDrawRectangleLines(this, rec, thick, color); return *this; } + inline Image& Draw(const ::Image& src, ::Rectangle srcRec, ::Rectangle dstRec, ::Color tint = WHITE) { ::ImageDraw(this, src, srcRec, dstRec, tint); @@ -340,6 +346,7 @@ class Image : public ::Image { ::ImageDrawText(this, text.c_str(), x, y, fontSize, color); return *this; } + inline Image& DrawText(::Font font, const std::string& text, ::Vector2 position, float fontSize, float spacing, ::Color tint = WHITE) { ::ImageDrawTextEx(this, font, text.c_str(), position, fontSize, spacing, tint); @@ -353,6 +360,7 @@ class Image : public ::Image { inline ::Vector4* GetImageDataNormalized() { return ::GetImageDataNormalized(*this); } + inline operator Texture2D() { return ::LoadTextureFromImage(*this); } diff --git a/include/Matrix.hpp b/include/Matrix.hpp index 046af9d..e287d0d 100644 --- a/include/Matrix.hpp +++ b/include/Matrix.hpp @@ -135,57 +135,74 @@ class Matrix : public ::Matrix { } #ifndef RAYLIB_CPP_NO_MATH - float Trace() { + inline float Trace() { return ::MatrixTrace(*this); } - Matrix Transpose() { + + inline Matrix Transpose() { return ::MatrixTranspose(*this); } - Matrix Invert() { + + inline Matrix Invert() { return ::MatrixInvert(*this); } - Matrix Normalize() { + + inline Matrix Normalize() { return ::MatrixNormalize(*this); } + static Matrix Identity() { return ::MatrixIdentity(); } + Matrix Add(::Matrix right) { return ::MatrixAdd(*this, right); } + Matrix operator+(const Matrix& matrix) { return ::MatrixAdd(*this, matrix); } + Matrix Subtract(::Matrix right) { return ::MatrixSubtract(*this, right); } + Matrix operator-(const Matrix& matrix) { return ::MatrixSubtract(*this, matrix); } + static Matrix Translate(float x, float y, float z) { return ::MatrixTranslate(x, y, z); } + static Matrix Rotate(Vector3 axis, float angle) { return ::MatrixRotate(axis, angle); } + static Matrix RotateXYZ(Vector3 angle) { return ::MatrixRotateXYZ(angle); } + static Matrix RotateX(float angle) { return ::MatrixRotateX(angle); } + static Matrix RotateY(float angle) { return ::MatrixRotateY(angle); } + static Matrix RotateZ(float angle) { return ::MatrixRotateZ(angle); } + static Matrix Scale(float x, float y, float z) { return ::MatrixScale(x, y, z); } + Matrix Multiply(Matrix right) { return ::MatrixMultiply(*this, right); } + Matrix operator*(const Matrix& matrix) { return ::MatrixMultiply(*this, matrix); } @@ -211,6 +228,7 @@ class Matrix : public ::Matrix { inline float16 ToFloatV() { return ::MatrixToFloatV(*this); } + operator float16() { return ToFloatV(); } diff --git a/include/Mouse.hpp b/include/Mouse.hpp index c9f4824..39f02cd 100644 --- a/include/Mouse.hpp +++ b/include/Mouse.hpp @@ -35,44 +35,56 @@ class Mouse { inline bool IsButtonPressed(int button) const { return ::IsMouseButtonPressed(button); } + inline bool IsButtonDown(int button) const { return ::IsMouseButtonDown(button); } + inline bool IsButtonReleased(int button) const { return ::IsMouseButtonReleased(button); } + inline bool IsButtonUp(int button) const { return ::IsMouseButtonUp(button); } + inline int GetX() const { return ::GetMouseX(); } + inline int GetY() const { return ::GetMouseY(); } + inline Mouse& SetX(int x) { ::SetMouseOffset(x, GetY()); return *this; } + inline Mouse& SetY(int y) { ::SetMouseOffset(GetX(), y); return *this; } + inline Vector2 GetPosition() const { return ::GetMousePosition(); } + inline Mouse& SetPosition(int x, int y) { ::SetMousePosition(x, y); return *this; } + inline Mouse& SetOffset(int offsetX, int offsetY) { ::SetMouseOffset(offsetX, offsetY); return *this; } + inline Mouse& SetScale(float scaleX, float scaleY) { ::SetMouseScale(scaleX, scaleY); return *this; } + inline float GetWheelMove() const { return ::GetMouseWheelMove(); } @@ -80,6 +92,7 @@ class Mouse { inline int GetCursor() const { return ::GetMouseCursor(); } + inline Mouse& SetCursor(int cursor) { ::SetMouseCursor(cursor); return *this; @@ -88,9 +101,11 @@ class Mouse { inline int GetTouchX() const { return ::GetTouchX(); } + inline int GetTouchY() const { return ::GetTouchY(); } + inline Vector2 GetTouchPosition(int index) const { return ::GetTouchPosition(index); } diff --git a/include/Sound.hpp b/include/Sound.hpp index 6460e70..907d987 100644 --- a/include/Sound.hpp +++ b/include/Sound.hpp @@ -80,6 +80,7 @@ class Sound : public ::Sound { ::StopSound(*this); return *this; } + inline Sound& Pause() { ::PauseSound(*this); return *this; @@ -102,10 +103,12 @@ class Sound : public ::Sound { inline bool IsPlaying() const { return ::IsSoundPlaying(*this); } + inline Sound& SetVolume(float volume) { ::SetSoundVolume(*this, volume); return *this; } + inline Sound& SetPitch(float pitch) { ::SetSoundPitch(*this, pitch); return *this; diff --git a/include/Texture.hpp b/include/Texture.hpp index 10dcdb3..e6af9d7 100644 --- a/include/Texture.hpp +++ b/include/Texture.hpp @@ -96,6 +96,7 @@ class Texture : public ::Texture { inline Image GetTextureData() const { return ::GetTextureData(*this); } + inline operator raylib::Image() { return GetTextureData(); } @@ -124,6 +125,7 @@ class Texture : public ::Texture { ::DrawTextureV(*this, position, tint); return *this; } + inline Texture& Draw(::Vector2 position, float rotation, float scale = 1.0f, ::Color tint = WHITE) { ::DrawTextureEx(*this, position, rotation, scale, tint); diff --git a/include/VrSimulator.hpp b/include/VrSimulator.hpp index 64acffc..28234d5 100644 --- a/include/VrSimulator.hpp +++ b/include/VrSimulator.hpp @@ -34,6 +34,7 @@ class VrSimulator { VrSimulator() { Init(); } + VrSimulator(::VrDeviceInfo info, ::Shader distortion) { Init(); Set(info, distortion); @@ -55,18 +56,22 @@ class VrSimulator { ::UpdateVrTracking(camera); return *this; } + inline VrSimulator& Set(::VrDeviceInfo info, ::Shader distortion) { ::SetVrConfiguration(info, distortion); return *this; } + inline VrSimulator& Toggle() { ::ToggleVrMode(); return *this; } + inline VrSimulator& Begin() { ::BeginVrDrawing(); return *this; } + inline VrSimulator& End() { ::EndVrDrawing(); return *this; diff --git a/include/Wave.hpp b/include/Wave.hpp index 034ba19..13d68a6 100644 --- a/include/Wave.hpp +++ b/include/Wave.hpp @@ -106,7 +106,7 @@ class Wave : public ::Wave { return ::LoadSoundFromWave(*this); } - inline float* GetWaveData() { + inline float* GetData() { return ::GetWaveData(*this); } diff --git a/include/Window.hpp b/include/Window.hpp index f4e3633..9d06925 100644 --- a/include/Window.hpp +++ b/include/Window.hpp @@ -85,15 +85,19 @@ class Window { inline static bool IsReady() { return ::IsWindowReady(); } + inline bool IsMinimized() const { return ::IsWindowMinimized(); } + inline bool IsFocused() const { return ::IsWindowFocused(); } + inline bool IsResized() const { return ::IsWindowResized(); } + inline bool IsHidden() const { return ::IsWindowHidden(); } @@ -101,42 +105,52 @@ class Window { inline bool IsFullscreen() const { return ::IsWindowFullscreen(); } + inline Window& ToggleFullscreen() { ::ToggleFullscreen(); return *this; } + inline Window& Unhide() { ::UnhideWindow(); return *this; } + inline Window& Hide() { ::HideWindow(); return *this; } + inline Window& SetIcon(Image image) { ::SetWindowIcon(image); return *this; } + inline Window& SetTitle(const std::string& title) { ::SetWindowTitle(title.c_str()); return *this; } + inline Window& SetPosition(int x, int y) { ::SetWindowPosition(x, y); return *this; } + inline Window& SetMonitor(int monitor) { ::SetWindowMonitor(monitor); return *this; } + inline Window& SetMinSize(int width, int height) { ::SetWindowMinSize(width, height); return *this; } + inline Window& SetSize(int width, int height) { ::SetWindowSize(width, height); return *this; } + inline void* GetHandle() const { return ::GetWindowHandle(); } diff --git a/vendor/raylib b/vendor/raylib index 482b8a5..fc1fc25 160000 --- a/vendor/raylib +++ b/vendor/raylib @@ -1 +1 @@ -Subproject commit 482b8a5e7e569c7abd665645b7678468bafa2e1a +Subproject commit fc1fc250e7ae39af7aadb1d00a7e098ea01aa8cd