Update raylib to 2020-12-02

This commit is contained in:
Rob Loach
2020-12-02 13:52:01 -05:00
parent d7c311dcec
commit bcfbb3215f
7 changed files with 106 additions and 40 deletions

View File

@@ -34,13 +34,6 @@
namespace raylib {
class Color : public ::Color {
public:
Color() {
r = 0;
g = 0;
b = 0;
a = 255;
}
Color(::Color color) {
r = color.r;
g = color.g;
@@ -48,12 +41,9 @@ class Color : public ::Color {
a = color.a;
}
Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255) {
r = red;
g = green;
b = blue;
a = alpha;
}
Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha) : ::Color{red, green, blue, alpha} {};
Color(unsigned char red, unsigned char green, unsigned char blue) : ::Color{red, green, blue, 255} {};
Color() {};
Color(::Vector3 hsv) {
set(::ColorFromHSV(hsv.x, hsv.y, hsv.z));

View File

@@ -365,10 +365,6 @@ class Image : public ::Image {
return ::GetImageData(*this);
}
inline ::Vector4* GetImageDataNormalized() {
return ::GetImageDataNormalized(*this);
}
::Texture2D LoadTexture() {
return ::LoadTextureFromImage(*this);
}

View File

@@ -65,24 +65,46 @@ class Model : public ::Model {
return *this;
}
/**
* Unload model (including meshes) from memory (RAM and/or VRAM)
*/
inline void Unload() {
::UnloadModel(*this);
}
/**
* Unload model (but not meshes) from memory (RAM and/or VRAM)
*/
inline void UnloadKeepMeshes() {
::UnloadModelKeepMeshes(*this);
}
/**
* Set material for a mesh
*/
inline Model& SetMeshMaterial(int meshId, int materialId) {
::SetModelMeshMaterial(this, meshId, materialId);
return *this;
}
/**
* Get collision info between ray and model
*/
inline RayHitInfo GetCollision(::Ray ray) const {
return ::GetCollisionRayModel(ray, *this);
}
/**
* Update model animation pose
*/
inline Model& UpdateModelAnimation(::ModelAnimation anim, int frame) {
::UpdateModelAnimation(*this, anim, frame);
return *this;
}
/**
* Check model animation skeleton match
*/
inline bool IsModelAnimationValid(::ModelAnimation anim) const {
return ::IsModelAnimationValid(*this, anim);
}

View File

@@ -36,12 +36,11 @@ class Rectangle : public ::Rectangle {
set(vec);
}
Rectangle(float X = 0, float Y = 0, float Width = 0, float Height = 0) {
x = X;
y = Y;
width = Width;
height = Height;
}
Rectangle(float x, float y, float width, float height) : ::Rectangle{x, y, width, height} {};
Rectangle(float x, float y, float width) : ::Rectangle{x, y, width, height} {};
Rectangle(float x, float y) : ::Rectangle{x, y, 0, 0} {};
Rectangle(float x) : ::Rectangle{x, 0, 0, 0} {};
Rectangle() {};
GETTERSETTER(float, X, x)
GETTERSETTER(float, Y, y)

View File

@@ -67,50 +67,83 @@ class Texture : public ::Texture {
return *this;
}
/**
* Load texture from image data
*/
void LoadFromImage(const ::Image& image) {
set(::LoadTextureFromImage(image));
}
/**
* Load cubemap from image, multiple image cubemap layouts supported
*/
void LoadTextureCubemap(const ::Image& image, int layoutType) {
set(::LoadTextureCubemap(image, layoutType));
}
/**
* Load texture from file into GPU memory (VRAM)
*/
void Load(const std::string& fileName) {
set(::LoadTexture(fileName.c_str()));
}
/**
* Unload texture from GPU memory (VRAM)
*/
inline void Unload() {
::UnloadTexture(*this);
}
/**
* Update GPU texture with new data
*/
inline Texture& Update(const void *pixels) {
::UpdateTexture(*this, pixels);
return *this;
}
/**
* Update GPU texture rectangle with new data
*/
inline Texture& UpdateRec(::Rectangle rec, const void *pixels) {
UpdateTextureRec(*this, rec, pixels);
return *this;
}
/**
* Get pixel data from GPU texture and return an Image
*/
inline Image GetTextureData() const {
return ::GetTextureData(*this);
}
/**
* Get pixel data from GPU texture and return an Image
*/
inline operator raylib::Image() {
return GetTextureData();
}
/**
* Generate GPU mipmaps for a texture
*/
inline Texture& GenMipmaps() {
::GenTextureMipmaps(this);
return *this;
}
/**
* Set texture scaling filter mode
*/
inline Texture& SetFilter(int filterMode) {
::SetTextureFilter(*this, filterMode);
return *this;
}
/**
* Set texture wrapping mode
*/
inline Texture& SetWrap(int wrapMode) {
::SetTextureWrap(*this, wrapMode);
return *this;
@@ -161,7 +194,7 @@ class Texture : public ::Texture {
return *this;
}
inline Texture& DrawTiled(Rectangle sourceRec, Rectangle destRec, Vector2 origin,
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;

View File

@@ -89,6 +89,20 @@ class Window {
return ::IsWindowReady();
}
/**
* Check if window is currently fullscreen
*/
inline bool IsFullscreen() const {
return ::IsWindowFullscreen();
}
/**
* Check if window is currently hidden
*/
inline bool IsHidden() const {
return ::IsWindowHidden();
}
/**
* Check if window is currently minimized
*/
@@ -96,6 +110,13 @@ class Window {
return ::IsWindowMinimized();
}
/**
* Check if window is currently minimized
*/
inline bool IsMaximized() const {
return ::IsWindowMaximized();
}
/**
* Check if window is currently focused
*/
@@ -110,18 +131,18 @@ class Window {
return ::IsWindowResized();
}
/**
* Check if window is currently hidden
*/
inline bool IsHidden() const {
return ::IsWindowHidden();
inline bool IsState(unsigned int flag) {
return ::IsWindowState(flag);
}
/**
* Check if window is currently fullscreen
*/
inline bool IsFullscreen() const {
return ::IsWindowFullscreen();
inline Window& SetState(unsigned int flag) {
::SetWindowState(flag);
return *this;
}
inline Window& ClearState(unsigned int flag) {
::ClearWindowState(flag);
return *this;
}
/**
@@ -132,20 +153,25 @@ class Window {
return *this;
}
inline Window& Unhide() {
::UnhideWindow();
inline Window& Maximize() {
::MaximizeWindow();
return *this;
}
inline Window& Hide() {
::HideWindow();
inline Window& Minimize() {
::MinimizeWindow();
return *this;
}
inline Window& Restore() {
::RestoreWindow();
return *this;
}
/**
* Set icon for window
*/
inline Window& SetIcon(Image image) {
inline Window& SetIcon(::Image image) {
::SetWindowIcon(image);
return *this;
}

2
vendor/raylib vendored