Update raylib

This commit is contained in:
Rob Loach
2020-10-25 14:07:19 -04:00
parent eaa2d5922c
commit 97f2ce3393
6 changed files with 103 additions and 44 deletions

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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;

View File

@@ -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 <string>
@@ -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

View File

@@ -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"

2
vendor/raylib vendored