diff --git a/include/Color.hpp b/include/Color.hpp index d70070d..5598154 100644 --- a/include/Color.hpp +++ b/include/Color.hpp @@ -54,15 +54,14 @@ class Color : public ::Color { } static Color FromHSV(float hue, float saturation, float value) { - ::Color color = ::ColorFromHSV(hue, saturation, value); - return color; + return ::ColorFromHSV(hue, saturation, value); } Color(int hexValue) { set(::GetColor(hexValue)); } - Color(Vector4 normalized) { + Color(::Vector4 normalized) { set(::ColorFromNormalized(normalized)); } @@ -99,6 +98,9 @@ class Color : public ::Color { return *this; } + /** + * Set background color (framebuffer clear color) + */ inline Color& ClearBackground() { ::ClearBackground(*this); return *this; @@ -109,6 +111,9 @@ class Color : public ::Color { return *this; } + /** + * Draw a pixel + */ inline Color& DrawPixel(::Vector2 pos) { ::DrawPixelV(pos, *this); return *this; @@ -186,6 +191,20 @@ class Color : public ::Color { return *this; } + /** + * Returns color with alpha applied, alpha goes from 0.0f to 1.0f + */ + Color Alpha(float alpha) { + return ::ColorAlpha(*this, alpha); + } + + /** + * Returns src alpha-blended into dst color with tint + */ + Color AlphaBlend(::Color dst, ::Color tint) { + return ::ColorAlphaBlend(dst, *this, tint); + } + protected: inline void set(const ::Color& color) { r = color.r; diff --git a/include/Model.hpp b/include/Model.hpp index 210afb2..c9ec5ec 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -75,8 +75,9 @@ class Model : public ::Model { /** * Unload model (but not meshes) from memory (RAM and/or VRAM) */ - inline void UnloadKeepMeshes() { + inline Model& UnloadKeepMeshes() { ::UnloadModelKeepMeshes(*this); + return *this; } /** diff --git a/include/Rectangle.hpp b/include/Rectangle.hpp index 27178fd..56bda6d 100644 --- a/include/Rectangle.hpp +++ b/include/Rectangle.hpp @@ -57,11 +57,15 @@ class Rectangle : public ::Rectangle { return *this; } + /** + * Draw a color-filled rectangle + */ inline Rectangle& Draw(::Color color) { ::DrawRectangle(static_cast(x), static_cast(y), static_cast(width), static_cast(height), color); return *this; } + inline Rectangle& Draw(::Vector2 origin, float rotation, ::Color color) { ::DrawRectanglePro(*this, origin, rotation, color); return *this; @@ -89,6 +93,7 @@ class Rectangle : public ::Rectangle { static_cast(height), color); return *this; } + inline Rectangle& DrawLinesEx(int lineThick, ::Color color) { ::DrawRectangleLinesEx(*this, lineThick, color); return *this; @@ -105,18 +110,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/Shader.hpp b/include/Shader.hpp index bb84ac3..e416bb4 100644 --- a/include/Shader.hpp +++ b/include/Shader.hpp @@ -86,21 +86,30 @@ class Shader : public ::Shader { return *this; } + /** + * Get shader uniform location + */ inline int GetLocation(const std::string& uniformName) const { return ::GetShaderLocation(*this, uniformName.c_str()); } + /** + * Get shader attribute location + */ inline int GetLocationAttrib(const std::string& attribName) const { return ::GetShaderLocationAttrib(*this, attribName.c_str()); } + /** + * Set shader uniform value + */ inline Shader& SetValue(int uniformLoc, const std::string& value, int uniformType) { ::SetShaderValue(*this, uniformLoc, value.c_str(), uniformType); return *this; } /** - * @see SetShaderValueV + * @see ::SetShaderValueV */ inline Shader& SetValue(int uniformLoc, const std::string& value, int uniformType, int count) { ::SetShaderValueV(*this, uniformLoc, value.c_str(), uniformType, count); diff --git a/include/Sound.hpp b/include/Sound.hpp index 907d987..86d1c26 100644 --- a/include/Sound.hpp +++ b/include/Sound.hpp @@ -62,53 +62,87 @@ 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; } + /** + * Stop playing a sound + */ inline Sound& Stop() { ::StopSound(*this); return *this; } + /** + * Pause a sound + */ inline Sound& Pause() { ::PauseSound(*this); return *this; } + + /** + * Resume a paused sound + */ inline Sound& Resume() { ::ResumeSound(*this); return *this; } + /** + * Play a sound (using multichannel buffer pool) + */ inline Sound& PlayMulti() { ::PlaySoundMulti(*this); return *this; } + /** + * Stop any sound playing (using multichannel buffer pool) + */ inline Sound& StopMulti() { ::StopSoundMulti(); return *this; } + /** + * Check if a sound is currently playing + */ inline bool IsPlaying() const { return ::IsSoundPlaying(*this); } + /** + * Set volume for a sound (1.0 is max level) + */ inline Sound& SetVolume(float volume) { ::SetSoundVolume(*this, volume); return *this; } + /** + * Set pitch for a sound (1.0 is base level) + */ inline Sound& SetPitch(float pitch) { ::SetSoundPitch(*this, pitch); return *this; diff --git a/include/Texture.hpp b/include/Texture.hpp index 19e5ad4..d7f5a28 100644 --- a/include/Texture.hpp +++ b/include/Texture.hpp @@ -209,6 +209,14 @@ class Texture : public ::Texture { return ::GetPixelDataSize(width, height, format); } + /** + * Define default texture used to draw shapes + */ + inline Texture& SetShapesTexture(Rectangle source) { + ::SetShapesTexture(*this, source); + return *this; + } + protected: inline void set(::Texture texture) { id = texture.id; diff --git a/include/Wave.hpp b/include/Wave.hpp index e0e2226..a853d92 100644 --- a/include/Wave.hpp +++ b/include/Wave.hpp @@ -76,30 +76,48 @@ class Wave : public ::Wave { return *this; } + /** + * Convert wave data to desired format + */ inline Wave& Format(int SampleRate = 0, int SampleSize = 0, int Channels = 2) { ::WaveFormat(this, SampleRate, SampleSize, Channels); return *this; } + /** + * Copy a wave to a new wave + */ inline Wave Copy() { return ::WaveCopy(*this); } + /** + * Crop a wave to defined samples range + */ inline Wave& Crop(int initSample, int finalSample) { ::WaveCrop(this, initSample, finalSample); return *this; } - inline Wave& Export(const std::string& fileName) { - ::ExportWave(*this, fileName.c_str()); - return *this; + /** + * Export wave data to file, returns true on success + */ + inline bool Export(const std::string& fileName) { + // TODO: Throw exception on error. + return ::ExportWave(*this, fileName.c_str()); } - inline Wave& ExportAsCode(const std::string& fileName) { - ::ExportWaveAsCode(*this, fileName.c_str()); - return *this; + /** + * Export wave sample data to code (.h), returns true on success + */ + inline bool ExportAsCode(const std::string& fileName) { + // TODO: Throw exception on error. + return ::ExportWaveAsCode(*this, fileName.c_str()); } + /** + * Unload wave data + */ void Unload() { if (data != NULL) { ::UnloadWave(*this); @@ -107,14 +125,23 @@ class Wave : public ::Wave { } } + /** + * Load sound from wave data + */ inline Sound LoadSound() { return ::LoadSoundFromWave(*this); } + /** + * Load sound from wave data + */ inline operator Sound() { return LoadSound(); } + /** + * Get samples data from wave as a floats array + */ inline float* GetData() { return ::GetWaveData(*this); }