From a6718bf863ed6b3b0f226d389dfb18de80f985f4 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Tue, 22 Sep 2020 15:00:14 -0400 Subject: [PATCH] Update raylib --- include/Color.hpp | 6 +++++- include/Font.hpp | 12 ++++++++---- include/Image.hpp | 12 ++++++++++++ include/Texture2D.hpp | 3 ++- include/VrSimulator.hpp | 4 ++-- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/include/Color.hpp b/include/Color.hpp index 527c42c..1430a7b 100644 --- a/include/Color.hpp +++ b/include/Color.hpp @@ -36,7 +36,11 @@ namespace raylib { a = alpha; }; Color(::Vector3 hsv) { - set(::ColorFromHSV(hsv)); + set(::ColorFromHSV(hsv.x, hsv.y, hsv.z)); + }; + static Color FromHSV(float hue, float saturation, float value) { + ::Color color = ::ColorFromHSV(hue, saturation, value); + return color; }; Color(int hexValue) { set(::GetColor(hexValue)); diff --git a/include/Font.hpp b/include/Font.hpp index eda114b..975e37d 100644 --- a/include/Font.hpp +++ b/include/Font.hpp @@ -17,19 +17,23 @@ namespace raylib { class Font : public ::Font { public: Font() { - set(GetFontDefault()); + set(::GetFontDefault()); } Font(const std::string& fileName) { - set(LoadFont(fileName.c_str())); + set(::LoadFont(fileName.c_str())); } Font(const std::string& fileName, int fontSize, int* fontChars, int charCount) { - set(LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount)); + set(::LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount)); } Font(::Image& image, ::Color key, int firstChar) { - set(LoadFontFromImage(image, key, firstChar)); + set(::LoadFontFromImage(image, key, firstChar)); + } + + Font(const std::string& fileType, const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int charsCount) { + set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars, charsCount)); } ~Font() { diff --git a/include/Image.hpp b/include/Image.hpp index 7a6081c..859d4df 100644 --- a/include/Image.hpp +++ b/include/Image.hpp @@ -168,6 +168,11 @@ namespace raylib { ::ImageCrop(this, crop); return *this; } + inline Image& Crop(int offsetX, int offsetY, int newWidth, int newHeight) { + ::ImageCrop(this, (Rectangle){ (float)offsetX, (float)offsetY, (float)newWidth, (float)newHeight }); + return *this; + } + inline Image& Resize(int newWidth, int newHeight) { ::ImageResize(this, newWidth, newHeight); return *this; @@ -176,14 +181,17 @@ namespace raylib { ::ImageResizeNN(this, newWidth, newHeight); return *this; } + inline Image& ResizeCanvas(int newWidth, int newHeight, int offsetX, int offsetY, Color color) { ::ImageResizeCanvas(this, newWidth, newHeight, offsetX, offsetY, color); return *this; } + inline Image& Mipmaps() { ::ImageMipmaps(this); return *this; } + inline Image& Dither(int rBpp, int gBpp, int bBpp, int aBpp) { ::ImageDither(this, rBpp, gBpp, bBpp, aBpp); return *this; @@ -202,18 +210,22 @@ namespace raylib { ::ImageRotateCW(this); return *this; } + inline Image& RotateCCW() { ::ImageRotateCCW(this); return *this; } + inline Image& ColorTint(::Color color = WHITE) { ::ImageColorTint(this, color); return *this; } + inline Image& ColorInvert() { ::ImageColorInvert(this); return *this; } + inline Image& ColorGrayscale() { ::ImageColorGrayscale(this); return *this; diff --git a/include/Texture2D.hpp b/include/Texture2D.hpp index 6345049..25c6246 100644 --- a/include/Texture2D.hpp +++ b/include/Texture2D.hpp @@ -157,8 +157,9 @@ namespace raylib { } }; - // Alias the Texture2D as Texture. + // Create the Texture2D aliases. typedef Texture2D Texture; + typedef Texture2D TextureCubemap; } #endif diff --git a/include/VrSimulator.hpp b/include/VrSimulator.hpp index 9df1eea..9f9b934 100644 --- a/include/VrSimulator.hpp +++ b/include/VrSimulator.hpp @@ -17,7 +17,7 @@ namespace raylib { VrSimulator() { Init(); }; - VrSimulator(VrDeviceInfo info, Shader distortion) { + VrSimulator(::VrDeviceInfo info, ::Shader distortion) { Init(); Set(info, distortion); }; @@ -38,7 +38,7 @@ namespace raylib { ::UpdateVrTracking(camera); return *this; } - inline VrSimulator& Set(VrDeviceInfo info, Shader distortion) { + inline VrSimulator& Set(::VrDeviceInfo info, ::Shader distortion) { ::SetVrConfiguration(info, distortion); return *this; }