diff --git a/include/AudioStream.hpp b/include/AudioStream.hpp index c489cfb9..0f3d685a 100644 --- a/include/AudioStream.hpp +++ b/include/AudioStream.hpp @@ -48,11 +48,11 @@ class AudioStream : public ::AudioStream { Unload(); } - GETTERSETTER(rAudioBuffer *, Buffer, buffer) - GETTERSETTER(rAudioProcessor *, Processor, processor) - GETTERSETTER(unsigned int, SampleRate, sampleRate) - GETTERSETTER(unsigned int, SampleSize, sampleSize) - GETTERSETTER(unsigned int, Channels, channels) + GETTER(rAudioBuffer *, Buffer, buffer) + GETTER(rAudioProcessor *, Processor, processor) + GETTER(unsigned int, SampleRate, sampleRate) + GETTER(unsigned int, SampleSize, sampleSize) + GETTER(unsigned int, Channels, channels) AudioStream& operator=(const ::AudioStream& stream) { set(stream); diff --git a/include/AutomationEventList.hpp b/include/AutomationEventList.hpp index f005aa2f..477bbff9 100644 --- a/include/AutomationEventList.hpp +++ b/include/AutomationEventList.hpp @@ -39,9 +39,9 @@ class AutomationEventList : public ::AutomationEventList { Unload(); } - GETTERSETTER(unsigned int, Capacity, capacity) - GETTERSETTER(unsigned int, Count, count) - GETTERSETTER(AutomationEvent*, Events, events) + GETTER(unsigned int, Capacity, capacity) + GETTER(unsigned int, Count, count) + GETTER(AutomationEvent*, Events, events) AutomationEventList& operator=(const ::AutomationEventList& other) { set(other); diff --git a/include/Font.hpp b/include/Font.hpp index 1128af8a..a77e56ce 100644 --- a/include/Font.hpp +++ b/include/Font.hpp @@ -108,11 +108,11 @@ class Font : public ::Font { } } - GETTERSETTER(int, BaseSize, baseSize) - GETTERSETTER(int, GlyphCount, glyphCount) - GETTERSETTER(int, GlyphPadding, glyphPadding) - GETTERSETTER(::Rectangle*, Recs, recs) - GETTERSETTER(::GlyphInfo*, Glyphs, glyphs) + GETTER(int, BaseSize, baseSize) + GETTER(int, GlyphCount, glyphCount) + GETTER(int, GlyphPadding, glyphPadding) + GETTER(::Rectangle*, Recs, recs) + GETTER(::GlyphInfo*, Glyphs, glyphs) /** * Get the texture atlas containing the glyphs. diff --git a/include/Image.hpp b/include/Image.hpp index 00a4c8e6..4564b869 100644 --- a/include/Image.hpp +++ b/include/Image.hpp @@ -316,11 +316,29 @@ class Image : public ::Image { } } - GETTERSETTER(void*, Data, data) - GETTERSETTER(int, Width, width) - GETTERSETTER(int, Height, height) - GETTERSETTER(int, Mipmaps, mipmaps) - GETTERSETTER(int, Format, format) + GETTER(void*, Data, data) + GETTER(int, Width, width) + GETTER(int, Height, height) + GETTER(int, Mipmaps, mipmaps) + GETTER(int, Format, format) + + /** + * Set the width of the image canvas. + * + * @see ResizeCanvas + */ + void SetWidth(int width, int offsetX = 0, int offsetY = 0, ::Color fill = {255, 255, 255, 255}) { + ResizeCanvas(width, height, offsetX, offsetY, fill); + } + + /** + * Set the height of the image canvas. + * + * @see ResizeCanvas + */ + void SetHeight(int height, int offsetX = 0, int offsetY = 0, ::Color fill = {255, 255, 255, 255}) { + ResizeCanvas(width, height, offsetX, offsetY, fill); + } /** * Retrieve the width and height of the image. diff --git a/include/Music.hpp b/include/Music.hpp index 2e6fa903..2b43dcc3 100644 --- a/include/Music.hpp +++ b/include/Music.hpp @@ -60,11 +60,11 @@ class Music : public ::Music { Unload(); } - GETTERSETTER(::AudioStream, Stream, stream) - GETTERSETTER(unsigned int, FrameCount, frameCount) + GETTER(::AudioStream, Stream, stream) + GETTER(unsigned int, FrameCount, frameCount) GETTERSETTER(bool, Looping, looping) - GETTERSETTER(int, CtxType, ctxType) - GETTERSETTER(void*, CtxData, ctxData) + GETTER(int, CtxType, ctxType) + GETTER(void*, CtxData, ctxData) Music& operator=(const ::Music& music) { set(music); diff --git a/include/RenderTexture.hpp b/include/RenderTexture.hpp index b47925ff..b8b0b4d9 100644 --- a/include/RenderTexture.hpp +++ b/include/RenderTexture.hpp @@ -43,7 +43,7 @@ class RenderTexture : public ::RenderTexture { other.depth = {}; } - GETTERSETTER(unsigned int, Id, id) + GETTER(unsigned int, Id, id) /** * Get the color buffer attachment texture. diff --git a/include/Shader.hpp b/include/Shader.hpp index ccbb7ac0..2dfb45fe 100644 --- a/include/Shader.hpp +++ b/include/Shader.hpp @@ -62,8 +62,8 @@ class Shader : public ::Shader { return ::LoadShaderFromMemory(vsCode, fsCode); } - GETTERSETTER(unsigned int, Id, id) - GETTERSETTER(int*, Locs, locs) + GETTER(unsigned int, Id, id) + GETTER(int*, Locs, locs) Shader& operator=(const ::Shader& shader) { set(shader); diff --git a/include/Sound.hpp b/include/Sound.hpp index 6232a985..76b5ae1b 100644 --- a/include/Sound.hpp +++ b/include/Sound.hpp @@ -59,8 +59,8 @@ class Sound : public ::Sound { Unload(); } - GETTERSETTER(unsigned int, FrameCount, frameCount) - GETTERSETTER(::AudioStream, Stream, stream) + GETTER(unsigned int, FrameCount, frameCount) + GETTER(::AudioStream, Stream, stream) Sound& operator=(Sound&& other) noexcept { if (this == &other) { diff --git a/include/TextureUnmanaged.hpp b/include/TextureUnmanaged.hpp index 01e48271..d32818ba 100644 --- a/include/TextureUnmanaged.hpp +++ b/include/TextureUnmanaged.hpp @@ -80,11 +80,11 @@ class TextureUnmanaged : public ::Texture { // Nothing. } - GETTERSETTER(unsigned int, Id, id) - GETTERSETTER(int, Width, width) - GETTERSETTER(int, Height, height) - GETTERSETTER(int, Mipmaps, mipmaps) - GETTERSETTER(int, Format, format) + GETTER(unsigned int, Id, id) + GETTER(int, Width, width) + GETTER(int, Height, height) + GETTER(int, Mipmaps, mipmaps) + GETTER(int, Format, format) TextureUnmanaged& operator=(const ::Texture& texture) { set(texture); diff --git a/include/Wave.hpp b/include/Wave.hpp index 757589be..7e248ee1 100644 --- a/include/Wave.hpp +++ b/include/Wave.hpp @@ -65,11 +65,11 @@ class Wave : public ::Wave { Unload(); } - GETTERSETTER(unsigned int, FrameCount, frameCount) - GETTERSETTER(unsigned int, SampleRate, sampleRate) - GETTERSETTER(unsigned int, SampleSize, sampleSize) - GETTERSETTER(unsigned int, Channels, channels) - GETTERSETTER(void *, Data, data) + GETTER(unsigned int, FrameCount, frameCount) + GETTER(unsigned int, SampleRate, sampleRate) + GETTER(unsigned int, SampleSize, sampleSize) + GETTER(unsigned int, Channels, channels) + GETTER(void *, Data, data) Wave& operator=(const ::Wave& wave) { set(wave); diff --git a/include/raylib-cpp-utils.hpp b/include/raylib-cpp-utils.hpp index 78330e04..9dbd260d 100644 --- a/include/raylib-cpp-utils.hpp +++ b/include/raylib-cpp-utils.hpp @@ -4,32 +4,31 @@ #ifndef RAYLIB_CPP_INCLUDE_RAYLIB_CPP_UTILS_HPP_ #define RAYLIB_CPP_INCLUDE_RAYLIB_CPP_UTILS_HPP_ -#ifndef GETTERSETTER +#ifndef GETTER /** - * A utility to build get and set methods on top of a property. + * A utility to build a get method on top of a property. * * @param type The type of the property. * @param method The human-readable name for the method. * @param name The machine-readable name of the property. */ -#define GETTERSETTER(type, method, name) \ +#define GETTER(type, method, name) \ /** Retrieves the name value for the object. @return The name value of the object. */ \ - type Get##method() const { return name; } \ - /** Sets the name value for the object. @param value The value of which to set name to. */ \ - void Set##method(type value) { name = value; } + type Get##method() const { return name; } #endif -#ifndef GETTER +#ifndef GETTERSETTER /** - * A utility to build get methods on top of a property. + * A utility to build get and set methods on top of a property. * * @param type The type of the property. * @param method The human-readable name for the method. * @param name The machine-readable name of the property. */ -#define GETTER(type, method, name) \ - /** Retrieves the name value for the object. @return The name value of the object. */ \ - type Get##method() const { return name; } +#define GETTERSETTER(type, method, name) \ + GETTER(type, method, name) \ + /** Sets the name value for the object. @param value The value of which to set name to. */ \ + void Set##method(type value) { name = value; } #endif #endif // RAYLIB_CPP_INCLUDE_RAYLIB_CPP_UTILS_HPP_