diff --git a/include/BoundingBox.hpp b/include/BoundingBox.hpp index fe3fc8b..c6f3eb2 100644 --- a/include/BoundingBox.hpp +++ b/include/BoundingBox.hpp @@ -57,19 +57,31 @@ class BoundingBox : public ::BoundingBox { return *this; } + /** + * Draw a bounding box with wires + */ inline BoundingBox& Draw(::Color color = WHITE) { DrawBoundingBox(*this, color); return *this; } + /** + * Detect collision between two boxes + */ inline bool CheckCollision(::BoundingBox box2) const { return CheckCollisionBoxes(*this, box2); } + /** + * Detect collision between box and sphere + */ inline bool CheckCollision(::Vector3 center, float radius) const { return CheckCollisionBoxSphere(*this, center, radius); } + /** + * Detect collision between ray and bounding box + */ inline bool CheckCollision(::Ray ray) const { return CheckCollisionRayBox(ray, *this); } diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index a61a2f7..17defa2 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -25,13 +25,15 @@ install(FILES Physics.hpp RayHitInfo.hpp Ray.hpp + raylib.hpp raylib-cpp.hpp raylib-cpp-utils.hpp + raymath.hpp Rectangle.hpp - RenderTexture2D.hpp + RenderTexture.hpp Shader.hpp Sound.hpp - Texture2D.hpp + Texture.hpp Vector2.hpp Vector3.hpp Vector4.hpp diff --git a/include/Color.hpp b/include/Color.hpp index d70070d..7df4df2 100644 --- a/include/Color.hpp +++ b/include/Color.hpp @@ -41,8 +41,10 @@ class Color : public ::Color { a = color.a; } - 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(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} {}; /** * Black. diff --git a/include/DroppedFiles.hpp b/include/DroppedFiles.hpp index 8dcc0ed..35b5c6b 100644 --- a/include/DroppedFiles.hpp +++ b/include/DroppedFiles.hpp @@ -56,6 +56,8 @@ class DroppedFiles { */ inline DroppedFiles& Clear() { ::ClearDroppedFiles(); + m_count = 0; + m_files = NULL; return *this; } diff --git a/include/Font.hpp b/include/Font.hpp index 8916ab6..61a5275 100644 --- a/include/Font.hpp +++ b/include/Font.hpp @@ -99,14 +99,27 @@ class Font : public ::Font { return *this; } + /** + * Measure string size for Font + */ inline Vector2 MeasureText(const std::string& text, float fontSize, float spacing) { return ::MeasureTextEx(*this, text.c_str(), fontSize, spacing); } + /** + * Get index position for a unicode character on font + */ inline int GetGlyphIndex(int character) const { return ::GetGlyphIndex(*this, character); } + /** + * Create an image from text (custom sprite font) + */ + inline Image ImageText(const std::string& text, float fontSize, float spacing, ::Color tint) { + return ::ImageTextEx(*this, text.c_str(), fontSize, spacing, tint); + } + protected: void set(const ::Font font) { baseSize = font.baseSize; diff --git a/include/Gamepad.hpp b/include/Gamepad.hpp index 23c8a8e..c343b45 100644 --- a/include/Gamepad.hpp +++ b/include/Gamepad.hpp @@ -55,12 +55,15 @@ class Gamepad { inline bool IsAvailable() const { return ::IsGamepadAvailable(number); } + inline bool IsName(const std::string& name) const { return ::IsGamepadName(number, name.c_str()); } + std::string GetName() const { return std::string(::GetGamepadName(number)); } + inline bool IsButtonPressed(int button) const { return ::IsGamepadButtonPressed(number, button); } diff --git a/include/Image.hpp b/include/Image.hpp index d1ec6f1..782d2b5 100644 --- a/include/Image.hpp +++ b/include/Image.hpp @@ -55,27 +55,42 @@ class Image : public ::Image { Image(int width, int height, Color color = WHITE) { set(::GenImageColor(width, height, color)); } + Image(::Font font, const std::string& text, float fontSize, float spacing, ::Color tint) { + set(::ImageTextEx(font, text.c_str(), fontSize, spacing, tint)); + } static Image Text(std::string text, int fontSize, Color color) { return ::ImageText(text.c_str(), fontSize, color); } - static Image Text(Font font, std::string text, float fontSize, float spacing, Color tint) { + static Image Text(::Font font, std::string text, float fontSize, float spacing, ::Color tint) { return ::ImageTextEx(font, text.c_str(), fontSize, spacing, tint); } + /** + * Get pixel data from screen buffer and return an Image (screenshot) + */ static Image GetScreenData() { return Image(::GetScreenData()); } + /** + * Generate image: plain color + */ static Image GenColor(int width, int height, Color color) { return ::GenImageColor(width, height, color); } + /** + * Generate image: vertical gradient + */ static Image GenGradientV(int width, int height, Color top, Color bottom) { return ::GenImageGradientV(width, height, top, bottom); } + /** + * Generate image: horizontal gradient + */ static Image GenGradientH(int width, int height, Color left, Color right) { return ::GenImageGradientH(width, height, left, right); } @@ -136,14 +151,19 @@ class Image : public ::Image { ::UnloadImage(*this); } - inline Image& Export(const std::string& fileName) { - ::ExportImage(*this, fileName.c_str()); - return *this; + /** + * Export image data to file, returns true on success + */ + inline bool Export(const std::string& fileName) { + // TODO(RobLoach): Switch to an invalid loading exception on false. + return ::ExportImage(*this, fileName.c_str()); } - inline Image& ExportAsCode(const std::string& fileName) { - ::ExportImageAsCode(*this, fileName.c_str()); - return *this; + /** + * Export image as code file defining an array of bytes, returns true on success + */ + inline bool ExportAsCode(const std::string& fileName) { + return ::ExportImageAsCode(*this, fileName.c_str()); } GETTERSETTER(void*, Data, data) @@ -152,42 +172,71 @@ class Image : public ::Image { GETTERSETTER(int, Mipmaps, mipmaps) GETTERSETTER(int, Format, format) + /** + * Create an image duplicate (useful for transformations) + */ inline Image Copy() { return ::ImageCopy(*this); } + + /** + * Create an image from another image piece + */ inline Image FromImage(::Rectangle rec) { return ::ImageFromImage(*this, rec); } + /** + * Convert image to POT (power-of-two) + */ inline Image& ToPOT(Color fillColor) { ::ImageToPOT(this, fillColor); return *this; } + /** + * Convert image data to desired format + */ inline Image& Format(int newFormat) { ::ImageFormat(this, newFormat); return *this; } + /** + * Apply alpha mask to image + */ inline Image& AlphaMask(Image alphaMask) { ::ImageAlphaMask(this, alphaMask); return *this; } + /** + * Crop image depending on alpha value + */ inline Image& AlphaCrop(float threshold) { ::ImageAlphaCrop(this, threshold); return *this; } + /** + * Premultiply alpha channel + */ inline Image& AlphaPremultiply() { ::ImageAlphaPremultiply(this); return *this; } + /** + * Crop an image to area defined by a rectangle + */ inline Image& Crop(::Rectangle crop) { ::ImageCrop(this, crop); return *this; } + + /** + * Crop an image to area defined by a rectangle + */ inline Image& Crop(int offsetX, int offsetY, int newWidth, int newHeight) { ::Rectangle rect{ static_cast(offsetX), @@ -199,26 +248,41 @@ class Image : public ::Image { return *this; } + /** + * Resize and image to new size + */ inline Image& Resize(int newWidth, int newHeight) { ::ImageResize(this, newWidth, newHeight); return *this; } + /** + * Resize and image to new size using Nearest-Neighbor scaling algorithm + */ inline Image& ResizeNN(int newWidth, int newHeight) { ::ImageResizeNN(this, newWidth, newHeight); return *this; } + /** + * Resize canvas and fill with color + */ inline Image& ResizeCanvas(int newWidth, int newHeight, int offsetX, int offsetY, Color color) { ::ImageResizeCanvas(this, newWidth, newHeight, offsetX, offsetY, color); return *this; } + /** + * Generate all mipmap levels for a provided image + */ inline Image& Mipmaps() { ::ImageMipmaps(this); return *this; } + /** + * Dither image data to 16bpp or lower (Floyd-Steinberg dithering) + */ inline Image& Dither(int rBpp, int gBpp, int bBpp, int aBpp) { ::ImageDither(this, rBpp, gBpp, bBpp, aBpp); return *this; @@ -228,6 +292,7 @@ class Image : public ::Image { ::ImageFlipVertical(this); return *this; } + inline Image& FlipHorizontal() { ::ImageFlipHorizontal(this); return *this; @@ -257,14 +322,17 @@ class Image : public ::Image { ::ImageColorGrayscale(this); return *this; } + inline Image& ColorContrast(float contrast) { ::ImageColorContrast(this, contrast); return *this; } + inline Image& ColorBrightness(int brightness) { ::ImageColorBrightness(this, brightness); return *this; } + inline Image& ColorReplace(::Color color, ::Color replace) { ::ImageColorReplace(this, color, replace); return *this; @@ -349,6 +417,7 @@ class Image : public ::Image { color); return *this; } + inline Image& DrawText(const std::string& text, int x, int y, int fontSize, ::Color color = WHITE) { ::ImageDrawText(this, text.c_str(), x, y, fontSize, color); diff --git a/include/Material.hpp b/include/Material.hpp index bc5962f..8384558 100644 --- a/include/Material.hpp +++ b/include/Material.hpp @@ -25,6 +25,9 @@ #ifndef RAYLIB_CPP_INCLUDE_MATERIAL_HPP_ #define RAYLIB_CPP_INCLUDE_MATERIAL_HPP_ +#include +#include + #include "./raylib.hpp" #include "./raylib-cpp-utils.hpp" @@ -43,6 +46,15 @@ class Material : public ::Material { Unload(); } + /** + * Load materials from model file + */ + static std::vector Load(const std::string& fileName) { + int count = 0; + ::Material* materials = ::LoadMaterials(fileName.c_str(), &count); + return std::vector(materials, materials + count); + } + GETTERSETTER(::Shader, Shader, shader) Material& operator=(const ::Material& material) { @@ -59,6 +71,9 @@ class Material : public ::Material { ::UnloadMaterial(*this); } + /** + * Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...) + */ inline Material& SetTexture(int mapType, ::Texture2D texture) { ::SetMaterialTexture(this, mapType, texture); return *this; diff --git a/include/Matrix.hpp b/include/Matrix.hpp index e287d0d..656ca4f 100644 --- a/include/Matrix.hpp +++ b/include/Matrix.hpp @@ -116,20 +116,32 @@ class Matrix : public ::Matrix { && m15 == other.m15; } + /** + * Set a custom projection matrix (replaces internal projection matrix) + */ inline Matrix& SetProjection() { ::SetMatrixProjection(*this); return *this; } + /** + * Set a custom modelview matrix (replaces internal modelview matrix) + */ inline Matrix& SetModelview() { ::SetMatrixModelview(*this); return *this; } + /** + * Get internal modelview matrix + */ static Matrix GetModelview() { return ::GetMatrixModelview(); } + /** + * Get internal projection matrix + */ static Matrix GetProjection() { return ::GetMatrixProjection(); } @@ -232,6 +244,15 @@ class Matrix : public ::Matrix { operator float16() { return ToFloatV(); } + + /** + * Set shader uniform value (matrix 4x4) + */ + inline Matrix& SetShaderValue(::Shader shader, int uniformLoc) { + ::SetShaderValueMatrix(shader, uniformLoc, *this); + return *this; + } + #endif protected: diff --git a/include/Mesh.hpp b/include/Mesh.hpp index d582ef8..b57d24f 100644 --- a/include/Mesh.hpp +++ b/include/Mesh.hpp @@ -26,6 +26,7 @@ #define RAYLIB_CPP_INCLUDE_MESH_HPP_ #include +#include #include "./raylib.hpp" #include "./raylib-cpp-utils.hpp" @@ -44,6 +45,15 @@ class Mesh : public ::Mesh { triangleCount = TriangleCount; } + /** + * Load meshes from model file + */ + static std::vector Load(const std::string fileName) { + int count = 0; + ::Mesh* meshes = LoadMeshes(fileName.c_str(), &count); + return std::vector(meshes, meshes + count); + } + GETTERSETTER(int, VertexCount, vertexCount) GETTERSETTER(int, TriangleCount, triangleCount) @@ -61,9 +71,12 @@ class Mesh : public ::Mesh { Unload(); } - inline Mesh& Export(const std::string& fileName) { - ExportMesh(*this, fileName.c_str()); - return *this; + /** + * Export mesh data to file + */ + inline bool Export(const std::string& fileName) { + // TODO(RobLoach): Switch to an exception when failed. + return ExportMesh(*this, fileName.c_str()); } inline void Unload() { @@ -98,7 +111,7 @@ class Mesh : public ::Mesh { } operator raylib::Model() { - return LoadModelFrom(); + return ::LoadModelFromMesh(*this); } protected: diff --git a/include/Model.hpp b/include/Model.hpp index 210afb2..526fa60 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -39,11 +39,11 @@ class Model : public ::Model { } Model(const std::string& fileName) { - set(LoadModel(fileName.c_str())); + set(::LoadModel(fileName.c_str())); } Model(::Mesh mesh) { - set(LoadModelFromMesh(mesh)); + set(::LoadModelFromMesh(mesh)); } ~Model() { diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index 273ded0..e200ef3 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -25,6 +25,9 @@ #ifndef RAYLIB_CPP_INCLUDE_MODELANIMATION_HPP_ #define RAYLIB_CPP_INCLUDE_MODELANIMATION_HPP_ +#include +#include + #include "./raylib.hpp" #include "./raylib-cpp-utils.hpp" #include "./Mesh.hpp" @@ -40,6 +43,15 @@ class ModelAnimation : public ::ModelAnimation { Unload(); } + /** + * Load model animations from file + */ + static std::vector Load(const std::string& fileName) { + int count = 0; + ::ModelAnimation* modelAnimations = ::LoadModelAnimations(fileName.c_str(), &count); + return std::vector(modelAnimations, modelAnimations + count); + } + GETTERSETTER(int, BoneCount, boneCount) GETTERSETTER(::BoneInfo*, Bones, bones) GETTERSETTER(int, FrameCount, frameCount) @@ -55,23 +67,28 @@ class ModelAnimation : public ::ModelAnimation { return *this; } + /** + * Unload animation data + */ inline void Unload() { ::UnloadModelAnimation(*this); } - inline ModelAnimation& UpdateAnimation(::Model model, int frame) { + /** + * Update model animation pose + */ + inline ModelAnimation& Update(::Model model, int frame) { ::UpdateModelAnimation(model, *this, frame); return *this; } + /** + * Check model animation skeleton match + */ inline bool IsValid(::Model model) const { return ::IsModelAnimationValid(model, *this); } - inline bool IsModelAnimationValid(::Model model) const { - return ::IsModelAnimationValid(model, *this); - } - protected: inline void set(::ModelAnimation model) { boneCount = model.boneCount; diff --git a/include/Music.hpp b/include/Music.hpp index 703b4bd..ca045e9 100644 --- a/include/Music.hpp +++ b/include/Music.hpp @@ -63,6 +63,9 @@ class Music : public ::Music { ::UnloadMusicStream(*this); } + /** + * Start music playing + */ inline Music& Play() { ::PlayMusicStream(*this); return *this; diff --git a/include/Physics.hpp b/include/Physics.hpp index ce202fd..4f5b82a 100644 --- a/include/Physics.hpp +++ b/include/Physics.hpp @@ -43,10 +43,12 @@ class Physics { Physics() { Init(); } + Physics(float gravityY) { Init(); SetGravity(0, gravityY); } + Physics(float gravityX, float gravityY) { Init(); SetGravity(gravityX, gravityY); diff --git a/include/Ray.hpp b/include/Ray.hpp index 859f122..eb7dc5f 100644 --- a/include/Ray.hpp +++ b/include/Ray.hpp @@ -65,27 +65,45 @@ class Ray : public ::Ray { return *this; } + /** + * Detect collision between ray and sphere + */ inline bool CheckCollisionSphere(::Vector3 center, float radius) const { return CheckCollisionRaySphere(*this, center, radius); } + /** + * Detect collision between ray and sphere, returns collision point + */ inline bool CheckCollisionSphereEx(::Vector3 center, float radius, ::Vector3 *collisionPoint) const { return CheckCollisionRaySphereEx(*this, center, radius, collisionPoint); } + /** + * Detect collision between ray and box + */ inline bool CheckCollisionBox(::BoundingBox box) const { return CheckCollisionRayBox(*this, box); } + /** + * Get collision info between ray and model + */ inline RayHitInfo GetCollisionModel(::Model model) { return GetCollisionRayModel(*this, model); } + /** + * Get collision info between ray and triangle + */ inline RayHitInfo GetCollisionTriangle(::Vector3 p1, ::Vector3 p2, ::Vector3 p3) { return GetCollisionRayTriangle(*this, p1, p2, p3); } + /** + * Get collision info between ray and ground plane (Y-normal plane) + */ inline RayHitInfo GetCollisionGround(float groundHeight) { return GetCollisionRayGround(*this, groundHeight); } diff --git a/include/RayHitInfo.hpp b/include/RayHitInfo.hpp index 0da12a3..064e8bf 100644 --- a/include/RayHitInfo.hpp +++ b/include/RayHitInfo.hpp @@ -42,6 +42,27 @@ class RayHitInfo : public ::RayHitInfo { normal = Normal; } + /** + * Get collision info between ray and model + */ + RayHitInfo(::Ray ray, ::Model model) { + set(::GetCollisionRayModel(ray, model)); + } + + /** + * Get collision info between ray and triangle + */ + RayHitInfo(::Ray ray, ::Vector3 p1, ::Vector3 p2, ::Vector3 p3) { + set(::GetCollisionRayTriangle(ray, p1, p2, p3)); + } + + /** + * Get collision info between ray and ground plane (Y-normal plane) + */ + RayHitInfo(::Ray ray, float groundHeight) { + set(::GetCollisionRayGround(ray, groundHeight)); + } + RayHitInfo& operator=(const ::RayHitInfo& ray) { set(ray); return *this; diff --git a/include/Rectangle.hpp b/include/Rectangle.hpp index 27178fd..3fa12ad 100644 --- a/include/Rectangle.hpp +++ b/include/Rectangle.hpp @@ -36,11 +36,11 @@ class Rectangle : public ::Rectangle { set(vec); } - 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() {}; + 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() : ::Rectangle{0, 0, 0, 0} {} GETTERSETTER(float, X, x) GETTERSETTER(float, Y, y) @@ -105,18 +105,34 @@ class Rectangle : public ::Rectangle { return *this; } + /** + * Check collision between two rectangles + */ inline bool CheckCollision(::Rectangle rec2) const { return ::CheckCollisionRecs(*this, rec2); } + /** + * Get collision rectangle for two rectangles collision + */ inline Rectangle GetCollision(::Rectangle rec2) const { return ::GetCollisionRec(*this, rec2); } + /** + * Check if point is inside rectangle + */ inline bool CheckCollision(::Vector2 point) const { return ::CheckCollisionPointRec(point, *this); } + /** + * Check collision between circle and rectangle + */ + inline bool CheckCollision(::Vector2 center, float radius) { + return CheckCollisionCircleRec(center, radius, *this); + } + protected: inline void set(::Rectangle rect) { x = rect.x; diff --git a/include/RenderTexture.hpp b/include/RenderTexture.hpp index b48204d..dda7678 100644 --- a/include/RenderTexture.hpp +++ b/include/RenderTexture.hpp @@ -65,11 +65,17 @@ class RenderTexture : public ::RenderTexture { UnloadRenderTexture(*this); } + /** + * Initializes render texture for drawing + */ inline RenderTexture& BeginTextureMode() { ::BeginTextureMode(*this); return *this; } + /** + * Ends drawing to render texture + */ inline RenderTexture& EndTextureMode() { ::EndTextureMode(); return *this; diff --git a/include/Shader.hpp b/include/Shader.hpp index bb84ac3..fa73c70 100644 --- a/include/Shader.hpp +++ b/include/Shader.hpp @@ -47,6 +47,18 @@ class Shader : public ::Shader { set(GetShaderDefault()); } + Shader(const std::string& vsFileName, const std::string& fsFileName) { + set(::LoadShader(vsFileName.c_str(), fsFileName.c_str())); + } + + static Shader Load(const std::string& vsFileName, const std::string& fsFileName) { + return ::LoadShader(vsFileName.c_str(), fsFileName.c_str()); + } + + static Shader LoadCode(const std::string& vsCode, const std::string& fsCode) { + return ::LoadShaderCode(vsCode.c_str(), fsCode.c_str()); + } + GETTERSETTER(unsigned int, Id, id) GETTERSETTER(int*, Locs, locs) @@ -68,14 +80,6 @@ class Shader : public ::Shader { ::UnloadShader(*this); } - static Shader Load(const std::string& vsFileName, const std::string& fsFileName) { - return ::LoadShader(vsFileName.c_str(), fsFileName.c_str()); - } - - static Shader LoadCode(const std::string& vsCode, const std::string& fsCode) { - return ::LoadShaderCode(vsCode.c_str(), fsCode.c_str()); - } - inline Shader& BeginShaderMode() { ::BeginShaderMode(*this); return *this; @@ -116,7 +120,7 @@ class Shader : public ::Shader { } /** - * @see ::SetShaderValueTexture + * Set shader uniform value for texture */ inline Shader& SetValue(int uniformLoc, Texture2D texture) { ::SetShaderValueTexture(*this, uniformLoc, texture); diff --git a/include/Sound.hpp b/include/Sound.hpp index 907d987..eb1e5bf 100644 --- a/include/Sound.hpp +++ b/include/Sound.hpp @@ -62,15 +62,24 @@ class Sound : public ::Sound { return *this; } + /** + * Update sound buffer with new data + */ inline Sound& Update(const void *data, int sampleCount) { ::UpdateSound(*this, data, sampleCount); return *this; } + /** + * Unload sound + */ inline void Unload() { ::UnloadSound(*this); } + /** + * Play a sound + */ inline Sound& Play() { ::PlaySound(*this); return *this; diff --git a/include/Texture.hpp b/include/Texture.hpp index 19e5ad4..0079bfb 100644 --- a/include/Texture.hpp +++ b/include/Texture.hpp @@ -43,6 +43,9 @@ class Texture : public ::Texture { LoadFromImage(image); } + /** + * Load texture from file into GPU memory (VRAM) + */ Texture(const std::string& fileName) { Load(fileName); } diff --git a/include/Vector2.hpp b/include/Vector2.hpp index 9f16d8c..282e7d3 100644 --- a/include/Vector2.hpp +++ b/include/Vector2.hpp @@ -40,9 +40,9 @@ class Vector2 : public ::Vector2 { set(vec); } - Vector2(float x, float y) : ::Vector2{x, y} {}; - Vector2(float x) : ::Vector2{x, 0} {}; - Vector2() : ::Vector2{0, 0} {}; + Vector2(float x, float y) : ::Vector2{x, y} {} + Vector2(float x) : ::Vector2{x, 0} {} + Vector2() : ::Vector2{0, 0} {} GETTERSETTER(float, X, x) GETTERSETTER(float, Y, y) diff --git a/include/Vector3.hpp b/include/Vector3.hpp index 7ab3735..b1d8449 100644 --- a/include/Vector3.hpp +++ b/include/Vector3.hpp @@ -40,10 +40,10 @@ class Vector3 : public ::Vector3 { set(vec); } - Vector3(float x, float y, float z) : ::Vector3{x, y, z} {}; - Vector3(float x, float y) : ::Vector3{x, y, 0} {}; - Vector3(float x) : ::Vector3{x, 0, 0} {}; - Vector3() {}; + Vector3(float x, float y, float z) : ::Vector3{x, y, z} {} + Vector3(float x, float y) : ::Vector3{x, y, 0} {} + Vector3(float x) : ::Vector3{x, 0, 0} {} + Vector3() {} Vector3(::Color color) { set(ColorToHSV(color)); diff --git a/include/Vector4.hpp b/include/Vector4.hpp index c523bda..5acc628 100644 --- a/include/Vector4.hpp +++ b/include/Vector4.hpp @@ -41,11 +41,11 @@ class Vector4 : public ::Vector4 { set(vec); } - Vector4(float x, float y, float z, float w) : ::Vector4{x, y, z, w} {}; - Vector4(float x, float y, float z) : ::Vector4{x, y, z, 0} {}; - Vector4(float x, float y) : ::Vector4{x, y, 0, 0} {}; - Vector4(float x) : ::Vector4{x, 0, 0, 0} {}; - Vector4() {}; + Vector4(float x, float y, float z, float w) : ::Vector4{x, y, z, w} {} + Vector4(float x, float y, float z) : ::Vector4{x, y, z, 0} {} + Vector4(float x, float y) : ::Vector4{x, y, 0, 0} {} + Vector4(float x) : ::Vector4{x, 0, 0, 0} {} + Vector4() {} Vector4(::Color color) { set(ColorNormalize(color)); diff --git a/include/VrSimulator.hpp b/include/VrSimulator.hpp index 28234d5..81f535c 100644 --- a/include/VrSimulator.hpp +++ b/include/VrSimulator.hpp @@ -76,6 +76,7 @@ class VrSimulator { ::EndVrDrawing(); return *this; } + inline void Close() { ::CloseVrSimulator(); } diff --git a/include/Wave.hpp b/include/Wave.hpp index e0e2226..ff22760 100644 --- a/include/Wave.hpp +++ b/include/Wave.hpp @@ -48,12 +48,18 @@ class Wave : public ::Wave { channels = Channels; } + /** + * Load wave data from file + */ Wave(const std::string& fileName) { - set(LoadWave(fileName.c_str())); + set(::LoadWave(fileName.c_str())); } + /** + * Load wave from memory buffer, fileType refers to extension: i.e. "wav" + */ Wave(const std::string& fileType, const unsigned char *fileData, int dataSize) { - set(LoadWaveFromMemory(fileType.c_str(), fileData, dataSize)); + set(::LoadWaveFromMemory(fileType.c_str(), fileData, dataSize)); } ~Wave() { diff --git a/include/Window.hpp b/include/Window.hpp index 7a8b96f..9c0ff26 100644 --- a/include/Window.hpp +++ b/include/Window.hpp @@ -131,15 +131,24 @@ class Window { return ::IsWindowResized(); } + /** + * Check if one specific window flag is enabled + */ inline bool IsState(unsigned int flag) { return ::IsWindowState(flag); } + /** + * Set window configuration state using flags + */ inline Window& SetState(unsigned int flag) { ::SetWindowState(flag); return *this; } + /** + * Clear window configuration state flags + */ inline Window& ClearState(unsigned int flag) { ::ClearWindowState(flag); return *this; @@ -153,16 +162,25 @@ class Window { return *this; } + /** + * Set window state: maximized, if resizable (only PLATFORM_DESKTOP) + */ inline Window& Maximize() { ::MaximizeWindow(); return *this; } + /** + * Set window state: minimized, if resizable (only PLATFORM_DESKTOP) + */ inline Window& Minimize() { ::MinimizeWindow(); return *this; } + /** + * Set window state: not minimized/maximized (only PLATFORM_DESKTOP) + */ inline Window& Restore() { ::RestoreWindow(); return *this; @@ -304,10 +322,16 @@ class Window { return ::GetFPS(); } + /** + * Returns time in seconds for last frame drawn + */ inline float GetFrameTime() const { return ::GetFrameTime(); } + /** + * Returns elapsed time in seconds since InitWindow() + */ inline double GetTime() const { return ::GetTime(); }