diff --git a/include/Mouse.hpp b/include/Mouse.hpp index 2aff9fe..e05365e 100644 --- a/include/Mouse.hpp +++ b/include/Mouse.hpp @@ -58,6 +58,15 @@ namespace raylib { inline float GetWheelMove() const { return ::GetMouseWheelMove(); } + + inline int GetCursor() const { + return ::GetMouseCursor(); + } + inline Mouse& SetCursor(int cursor) { + ::SetMouseCursor(cursor); + return *this; + } + inline int GetTouchX() const { return ::GetTouchX(); } diff --git a/include/RenderTexture2D.hpp b/include/RenderTexture.hpp similarity index 56% rename from include/RenderTexture2D.hpp rename to include/RenderTexture.hpp index 686a0a4..298ba08 100644 --- a/include/RenderTexture2D.hpp +++ b/include/RenderTexture.hpp @@ -1,5 +1,5 @@ -#ifndef RAYLIB_CPP_RENDERTEXTURE2D_HPP_ -#define RAYLIB_CPP_RENDERTEXTURE2D_HPP_ +#ifndef RAYLIB_CPP_RenderTexture_HPP_ +#define RAYLIB_CPP_RenderTexture_HPP_ #ifdef __cplusplus extern "C"{ @@ -12,15 +12,15 @@ extern "C"{ #include "./raylib-cpp-utils.hpp" namespace raylib { - class RenderTexture2D : public ::RenderTexture2D { + class RenderTexture : public ::RenderTexture { public: - RenderTexture2D(::RenderTexture2D renderTexture) { + RenderTexture(::RenderTexture renderTexture) { set(renderTexture); }; - RenderTexture2D(unsigned int Id) { + RenderTexture(unsigned int Id) { id = Id; }; - RenderTexture2D(int width, int height) { + RenderTexture(int width, int height) { set(LoadRenderTexture(width, height)); } @@ -28,17 +28,17 @@ namespace raylib { GETTERSETTER(Texture2D,Texture,texture) GETTERSETTER(Texture2D,Depth,depth) - RenderTexture2D& operator=(const ::RenderTexture2D& texture) { + RenderTexture& operator=(const ::RenderTexture& texture) { set(texture); return *this; } - RenderTexture2D& operator=(const RenderTexture2D& texture) { + RenderTexture& operator=(const RenderTexture& texture) { set(texture); return *this; } - ~RenderTexture2D() { + ~RenderTexture() { Unload(); }; @@ -46,24 +46,24 @@ namespace raylib { UnloadRenderTexture(*this); } - inline RenderTexture2D& BeginTextureMode() { + inline RenderTexture& BeginTextureMode() { ::BeginTextureMode(*this); return *this; } - inline RenderTexture2D& EndTextureMode() { + inline RenderTexture& EndTextureMode() { ::EndTextureMode(); return *this; } protected: - inline void set(::RenderTexture2D renderTexture) { + inline void set(::RenderTexture renderTexture) { id = renderTexture.id; texture = renderTexture.texture; depth = renderTexture.depth; } }; - typedef RenderTexture2D RenderTexture; + typedef RenderTexture RenderTexture2D; } #endif diff --git a/include/Shader.hpp b/include/Shader.hpp index 3ecd3b8..2ea1f27 100644 --- a/include/Shader.hpp +++ b/include/Shader.hpp @@ -10,6 +10,7 @@ extern "C"{ #endif #include "./raylib-cpp-utils.hpp" +#include "Texture.hpp" namespace raylib { class Shader : public ::Shader { @@ -71,6 +72,55 @@ namespace raylib { return ::GetShaderLocation(*this, uniformName.c_str()); } + inline int GetLocationAttrib(const std::string& attribName) const { + return ::GetShaderLocationAttrib(*this, attribName.c_str()); + } + + inline Shader& SetValue(int uniformLoc, const std::string& value, int uniformType) { + ::SetShaderValue(*this, uniformLoc, value.c_str(), uniformType); + return *this; + } + + /** + * @see SetShaderValueV + */ + inline Shader& SetValue(int uniformLoc, const std::string& value, int uniformType, int count) { + ::SetShaderValueV(*this, uniformLoc, value.c_str(), uniformType, count); + return *this; + } + + /** + * @see ::SetShaderValueMatrix + */ + inline Shader& SetValue(int uniformLoc, Matrix mat) { + ::SetShaderValueMatrix(*this, uniformLoc, mat); + return *this; + } + + /** + * @see ::SetShaderValueTexture + */ + inline Shader& SetValue(int uniformLoc, Texture2D texture) { + ::SetShaderValueTexture(*this, uniformLoc, texture); + return *this; + } + + ::TextureCubemap GenTextureCubemap(Texture2D panorama, int size, int format) { + return ::GenTextureCubemap(*this, panorama, size, format); + } + + ::TextureCubemap GenTextureIrradiance(Texture2D panorama, int size) { + return ::GenTextureIrradiance(*this, panorama, size); + } + + ::TextureCubemap GenTexturePrefilter(Texture2D panorama, int size) { + return ::GenTexturePrefilter(*this, panorama, size); + } + + ::Texture2D GenTextureBRDF(int size) { + return ::GenTextureBRDF(*this, size); + } + protected: inline void set(::Shader shader) { id = shader.id; diff --git a/include/Texture2D.hpp b/include/Texture.hpp similarity index 60% rename from include/Texture2D.hpp rename to include/Texture.hpp index 4eacbba..778a86c 100644 --- a/include/Texture2D.hpp +++ b/include/Texture.hpp @@ -1,5 +1,5 @@ -#ifndef RAYLIB_CPP_TEXTURE2D_HPP_ -#define RAYLIB_CPP_TEXTURE2D_HPP_ +#ifndef RAYLIB_CPP_Texture_HPP_ +#define RAYLIB_CPP_Texture_HPP_ #include @@ -16,21 +16,21 @@ extern "C"{ #include "./Material.hpp" namespace raylib { - class Texture2D : public ::Texture2D { + class Texture : public ::Texture { public: - Texture2D() { + Texture() { set(::GetTextureDefault()); }; - Texture2D(::Image& image) { + Texture(::Image& image) { LoadFromImage(image); } - Texture2D(const std::string& fileName) { + Texture(const std::string& fileName) { Load(fileName); } - ~Texture2D() { + ~Texture() { Unload(); }; @@ -40,12 +40,12 @@ namespace raylib { GETTERSETTER(int,Mipmaps,mipmaps) GETTERSETTER(int,Format,format) - Texture2D& operator=(const ::Texture2D& texture) { + Texture& operator=(const ::Texture& texture) { set(texture); return *this; } - Texture2D& operator=(const Texture2D& texture) { + Texture& operator=(const Texture& texture) { set(texture); return *this; } @@ -66,12 +66,12 @@ namespace raylib { ::UnloadTexture(*this); } - inline Texture2D& Update(const void *pixels) { + inline Texture& Update(const void *pixels) { ::UpdateTexture(*this, pixels); return *this; } - inline Texture2D& UpdateRec(Rectangle rec, const void *pixels) { + inline Texture& UpdateRec(Rectangle rec, const void *pixels) { UpdateTextureRec(*this, rec, pixels); return *this; } @@ -83,63 +83,63 @@ namespace raylib { return GetTextureData(); } - inline Texture2D& GenMipmaps() { + inline Texture& GenMipmaps() { ::GenTextureMipmaps(this); return *this; } - inline Texture2D& SetFilter(int filterMode) { + inline Texture& SetFilter(int filterMode) { ::SetTextureFilter(*this, filterMode); return *this; } - inline Texture2D& SetWrap(int wrapMode) { + inline Texture& SetWrap(int wrapMode) { ::SetTextureWrap(*this, wrapMode); return *this; } - inline Texture2D& Draw(int posX, int posY, ::Color tint = WHITE) { + inline Texture& Draw(int posX, int posY, ::Color tint = WHITE) { ::DrawTexture(*this, posX, posY, tint); return *this; } - inline Texture2D& Draw(::Vector2 position, ::Color tint = WHITE) { + inline Texture& Draw(::Vector2 position, ::Color tint = WHITE) { ::DrawTextureV(*this, position, tint); return *this; } - inline Texture2D& Draw(::Vector2 position, float rotation, float scale = 1.0f, ::Color tint = WHITE) { + inline Texture& Draw(::Vector2 position, float rotation, float scale = 1.0f, ::Color tint = WHITE) { ::DrawTextureEx(*this, position, rotation, scale, tint); return *this; } - inline Texture2D& Draw(::Rectangle sourceRec, ::Vector2 position, ::Color tint = WHITE) { + inline Texture& Draw(::Rectangle sourceRec, ::Vector2 position, ::Color tint = WHITE) { ::DrawTextureRec(*this, sourceRec, position, tint); return *this; } - inline Texture2D& Draw(::Vector2 tiling, ::Vector2 offset, ::Rectangle quad, ::Color tint = WHITE) { + inline Texture& Draw(::Vector2 tiling, ::Vector2 offset, ::Rectangle quad, ::Color tint = WHITE) { ::DrawTextureQuad(*this, tiling, offset, quad, tint); return *this; } - inline Texture2D& Draw(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin, float rotation = 0, ::Color tint = WHITE) { + inline Texture& Draw(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin, float rotation = 0, ::Color tint = WHITE) { ::DrawTexturePro(*this, sourceRec, destRec, origin, rotation, tint); return *this; } - inline Texture2D& Draw(::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin, float rotation = 0, ::Color tint = WHITE) { + inline Texture& Draw(::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin, float rotation = 0, ::Color tint = WHITE) { ::DrawTextureNPatch(*this, nPatchInfo, destRec, origin, rotation, tint); return *this; } - inline Texture2D& Draw(::Vector3 position, float width, float height, float length, ::Color color = WHITE) { + inline Texture& Draw(::Vector3 position, float width, float height, float length, ::Color color = WHITE) { ::DrawCubeTexture(*this, position, width, height, length, color); return *this; } - inline Texture2D& DrawTiled(Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, float scale, Color tint = WHITE) { + inline Texture& DrawTiled(Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, float scale, Color tint = WHITE) { ::DrawTextureTiled(*this, sourceRec, destRec, origin, rotation, scale, tint); return *this; } - inline Texture2D& SetMaterialTexture(Material *material, int mapType) { + inline Texture& SetMaterialTexture(Material *material, int mapType) { ::SetMaterialTexture(material, mapType, *this); return *this; } @@ -149,7 +149,7 @@ namespace raylib { } protected: - inline void set(::Texture2D texture) { + inline void set(::Texture texture) { id = texture.id; width = texture.width; height = texture.height; @@ -158,9 +158,9 @@ namespace raylib { } }; - // Create the Texture2D aliases. - typedef Texture2D Texture; - typedef Texture2D TextureCubemap; + // Create the Texture aliases. + typedef Texture Texture2D; + typedef Texture TextureCubemap; } #endif diff --git a/include/raylib-cpp.hpp b/include/raylib-cpp.hpp index d6ed516..93e8d65 100644 --- a/include/raylib-cpp.hpp +++ b/include/raylib-cpp.hpp @@ -71,10 +71,10 @@ namespace raylib { #include "./Ray.hpp" #include "./RayHitInfo.hpp" #include "./Rectangle.hpp" -#include "./RenderTexture2D.hpp" +#include "./RenderTexture.hpp" #include "./Shader.hpp" #include "./Sound.hpp" -#include "./Texture2D.hpp" +#include "./Texture.hpp" #include "./Vector2.hpp" #include "./Vector3.hpp" #include "./Vector4.hpp" diff --git a/vendor/raylib b/vendor/raylib index fa357b8..482b8a5 160000 --- a/vendor/raylib +++ b/vendor/raylib @@ -1 +1 @@ -Subproject commit fa357b8d5d934f54dd1b3cd343b05f06b732d28f +Subproject commit 482b8a5e7e569c7abd665645b7678468bafa2e1a