Skip to content

Commit ac5e553

Browse files
committed
Update some Get/Set methods
1 parent 473b922 commit ac5e553

File tree

11 files changed

+65
-48
lines changed

11 files changed

+65
-48
lines changed

include/AudioStream.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ class AudioStream : public ::AudioStream {
4848
Unload();
4949
}
5050

51-
GETTERSETTER(rAudioBuffer *, Buffer, buffer)
52-
GETTERSETTER(rAudioProcessor *, Processor, processor)
53-
GETTERSETTER(unsigned int, SampleRate, sampleRate)
54-
GETTERSETTER(unsigned int, SampleSize, sampleSize)
55-
GETTERSETTER(unsigned int, Channels, channels)
51+
GETTER(rAudioBuffer *, Buffer, buffer)
52+
GETTER(rAudioProcessor *, Processor, processor)
53+
GETTER(unsigned int, SampleRate, sampleRate)
54+
GETTER(unsigned int, SampleSize, sampleSize)
55+
GETTER(unsigned int, Channels, channels)
5656

5757
AudioStream& operator=(const ::AudioStream& stream) {
5858
set(stream);

include/AutomationEventList.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class AutomationEventList : public ::AutomationEventList {
3939
Unload();
4040
}
4141

42-
GETTERSETTER(unsigned int, Capacity, capacity)
43-
GETTERSETTER(unsigned int, Count, count)
44-
GETTERSETTER(AutomationEvent*, Events, events)
42+
GETTER(unsigned int, Capacity, capacity)
43+
GETTER(unsigned int, Count, count)
44+
GETTER(AutomationEvent*, Events, events)
4545

4646
AutomationEventList& operator=(const ::AutomationEventList& other) {
4747
set(other);

include/Font.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ class Font : public ::Font {
108108
}
109109
}
110110

111-
GETTERSETTER(int, BaseSize, baseSize)
112-
GETTERSETTER(int, GlyphCount, glyphCount)
113-
GETTERSETTER(int, GlyphPadding, glyphPadding)
114-
GETTERSETTER(::Rectangle*, Recs, recs)
115-
GETTERSETTER(::GlyphInfo*, Glyphs, glyphs)
111+
GETTER(int, BaseSize, baseSize)
112+
GETTER(int, GlyphCount, glyphCount)
113+
GETTER(int, GlyphPadding, glyphPadding)
114+
GETTER(::Rectangle*, Recs, recs)
115+
GETTER(::GlyphInfo*, Glyphs, glyphs)
116116

117117
/**
118118
* Get the texture atlas containing the glyphs.

include/Image.hpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,29 @@ class Image : public ::Image {
316316
}
317317
}
318318

319-
GETTERSETTER(void*, Data, data)
320-
GETTERSETTER(int, Width, width)
321-
GETTERSETTER(int, Height, height)
322-
GETTERSETTER(int, Mipmaps, mipmaps)
323-
GETTERSETTER(int, Format, format)
319+
GETTER(void*, Data, data)
320+
GETTER(int, Width, width)
321+
GETTER(int, Height, height)
322+
GETTER(int, Mipmaps, mipmaps)
323+
GETTER(int, Format, format)
324+
325+
/**
326+
* Set the width of the image canvas.
327+
*
328+
* @see ResizeCanvas
329+
*/
330+
void SetWidth(int width, int offsetX = 0, int offsetY = 0, ::Color fill = {255, 255, 255, 255}) {
331+
ResizeCanvas(width, height, offsetX, offsetY, fill);
332+
}
333+
334+
/**
335+
* Set the height of the image canvas.
336+
*
337+
* @see ResizeCanvas
338+
*/
339+
void SetHeight(int height, int offsetX = 0, int offsetY = 0, ::Color fill = {255, 255, 255, 255}) {
340+
ResizeCanvas(width, height, offsetX, offsetY, fill);
341+
}
324342

325343
/**
326344
* Retrieve the width and height of the image.

include/Music.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ class Music : public ::Music {
6060
Unload();
6161
}
6262

63-
GETTERSETTER(::AudioStream, Stream, stream)
64-
GETTERSETTER(unsigned int, FrameCount, frameCount)
63+
GETTER(::AudioStream, Stream, stream)
64+
GETTER(unsigned int, FrameCount, frameCount)
6565
GETTERSETTER(bool, Looping, looping)
66-
GETTERSETTER(int, CtxType, ctxType)
67-
GETTERSETTER(void*, CtxData, ctxData)
66+
GETTER(int, CtxType, ctxType)
67+
GETTER(void*, CtxData, ctxData)
6868

6969
Music& operator=(const ::Music& music) {
7070
set(music);

include/RenderTexture.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class RenderTexture : public ::RenderTexture {
4343
other.depth = {};
4444
}
4545

46-
GETTERSETTER(unsigned int, Id, id)
46+
GETTER(unsigned int, Id, id)
4747

4848
/**
4949
* Get the color buffer attachment texture.

include/Shader.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class Shader : public ::Shader {
6262
return ::LoadShaderFromMemory(vsCode, fsCode);
6363
}
6464

65-
GETTERSETTER(unsigned int, Id, id)
66-
GETTERSETTER(int*, Locs, locs)
65+
GETTER(unsigned int, Id, id)
66+
GETTER(int*, Locs, locs)
6767

6868
Shader& operator=(const ::Shader& shader) {
6969
set(shader);

include/Sound.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class Sound : public ::Sound {
5959
Unload();
6060
}
6161

62-
GETTERSETTER(unsigned int, FrameCount, frameCount)
63-
GETTERSETTER(::AudioStream, Stream, stream)
62+
GETTER(unsigned int, FrameCount, frameCount)
63+
GETTER(::AudioStream, Stream, stream)
6464

6565
Sound& operator=(Sound&& other) noexcept {
6666
if (this == &other) {

include/TextureUnmanaged.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ class TextureUnmanaged : public ::Texture {
8080
// Nothing.
8181
}
8282

83-
GETTERSETTER(unsigned int, Id, id)
84-
GETTERSETTER(int, Width, width)
85-
GETTERSETTER(int, Height, height)
86-
GETTERSETTER(int, Mipmaps, mipmaps)
87-
GETTERSETTER(int, Format, format)
83+
GETTER(unsigned int, Id, id)
84+
GETTER(int, Width, width)
85+
GETTER(int, Height, height)
86+
GETTER(int, Mipmaps, mipmaps)
87+
GETTER(int, Format, format)
8888

8989
TextureUnmanaged& operator=(const ::Texture& texture) {
9090
set(texture);

include/Wave.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ class Wave : public ::Wave {
6565
Unload();
6666
}
6767

68-
GETTERSETTER(unsigned int, FrameCount, frameCount)
69-
GETTERSETTER(unsigned int, SampleRate, sampleRate)
70-
GETTERSETTER(unsigned int, SampleSize, sampleSize)
71-
GETTERSETTER(unsigned int, Channels, channels)
72-
GETTERSETTER(void *, Data, data)
68+
GETTER(unsigned int, FrameCount, frameCount)
69+
GETTER(unsigned int, SampleRate, sampleRate)
70+
GETTER(unsigned int, SampleSize, sampleSize)
71+
GETTER(unsigned int, Channels, channels)
72+
GETTER(void *, Data, data)
7373

7474
Wave& operator=(const ::Wave& wave) {
7575
set(wave);

include/raylib-cpp-utils.hpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,31 @@
44
#ifndef RAYLIB_CPP_INCLUDE_RAYLIB_CPP_UTILS_HPP_
55
#define RAYLIB_CPP_INCLUDE_RAYLIB_CPP_UTILS_HPP_
66

7-
#ifndef GETTERSETTER
7+
#ifndef GETTER
88
/**
9-
* A utility to build get and set methods on top of a property.
9+
* A utility to build a get method on top of a property.
1010
*
1111
* @param type The type of the property.
1212
* @param method The human-readable name for the method.
1313
* @param name The machine-readable name of the property.
1414
*/
15-
#define GETTERSETTER(type, method, name) \
15+
#define GETTER(type, method, name) \
1616
/** Retrieves the name value for the object. @return The name value of the object. */ \
17-
type Get##method() const { return name; } \
18-
/** Sets the name value for the object. @param value The value of which to set name to. */ \
19-
void Set##method(type value) { name = value; }
17+
type Get##method() const { return name; }
2018
#endif
2119

22-
#ifndef GETTER
20+
#ifndef GETTERSETTER
2321
/**
24-
* A utility to build get methods on top of a property.
22+
* A utility to build get and set methods on top of a property.
2523
*
2624
* @param type The type of the property.
2725
* @param method The human-readable name for the method.
2826
* @param name The machine-readable name of the property.
2927
*/
30-
#define GETTER(type, method, name) \
31-
/** Retrieves the name value for the object. @return The name value of the object. */ \
32-
type Get##method() const { return name; }
28+
#define GETTERSETTER(type, method, name) \
29+
GETTER(type, method, name) \
30+
/** Sets the name value for the object. @param value The value of which to set name to. */ \
31+
void Set##method(type value) { name = value; }
3332
#endif
3433

3534
#endif // RAYLIB_CPP_INCLUDE_RAYLIB_CPP_UTILS_HPP_

0 commit comments

Comments
 (0)