Wizard Engine
2D cross-platform game engine built around SDL2
 
Loading...
Searching...
No Matches
wze::sprite Class Referencefinal
Inheritance diagram for wze::sprite:
wze::renderable wze::animatable wze::component

Public Member Functions

float x () const final
 
void set_x (float x) final
 
float y () const final
 
void set_y (float y) final
 
float z () const final
 
void set_z (float z)
 
float angle () const final
 
void set_angle (float angle) final
 
float width () const final
 
void set_width (float width)
 
float height () const final
 
void set_height (float height)
 
bool spatial () const final
 
void set_spatial (bool spatial)
 
std::shared_ptr< wze::texture > const & texture () const final
 
void set_texture (std::shared_ptr< wze::texture > const &texture) final
 Sets the wze::texture of the object.
 
uint8_t color_r () const final
 
void set_color_r (uint8_t color_r)
 
uint8_t color_g () const final
 
void set_color_g (uint8_t color_g)
 
uint8_t color_b () const final
 
void set_color_b (uint8_t color_b)
 
uint8_t color_a () const final
 
void set_color_a (uint8_t color_a)
 
enum flip flip () const final
 
void set_flip (enum flip flip)
 
bool visible () const final
 
void set_visible (bool visible)
 
uint8_t priority () const final
 
void set_priority (uint8_t priority)
 
bool animated () const final
 Gets whether the object should be animated.
 
void set_animated (bool animated)
 
float x_offset () const final
 
void set_x_offset (float x_offset)
 
float y_offset () const final
 
void set_y_offset (float y_offset)
 
float angle_offset () const final
 
void set_angle_offset (float angle_offset)
 
bool attach_x () const final
 
void set_attach_x (bool attach_x)
 
bool attach_y () const final
 
void set_attach_y (bool attach_y)
 
bool attach_angle () const final
 
void set_attach_angle (bool attach_angle)
 
bool x_angle_lock () const final
 
void set_x_angle_lock (bool x_angle_lock)
 
bool y_angle_lock () const final
 
void set_y_angle_lock (bool y_angle_lock)
 
 sprite (float x=0, float y=0, float z=0, float angle=0, float width=0, float height=0, bool spatial=false, std::shared_ptr< wze::texture > const &texture={}, uint8_t color_r=std::numeric_limits< uint8_t >::max(), uint8_t color_g=std::numeric_limits< uint8_t >::max(), uint8_t color_b=std::numeric_limits< uint8_t >::max(), uint8_t color_a=std::numeric_limits< uint8_t >::max(), enum flip flip=FLIP_NONE, bool visible=true, uint8_t priority=std::numeric_limits< uint8_t >::max()/2, bool animated=true, float x_offset=0, float y_offset=0, float angle_offset=0, bool attach_x=true, bool attach_y=true, bool attach_angle=true, bool x_angle_lock=true, bool y_angle_lock=true)
 
- Public Member Functions inherited from wze::renderable
SDL_FRect const & screen_area () const
 
float screen_angle () const
 
 renderable (renderable const &other)
 
renderableoperator= (renderable const &other)
 
- Public Member Functions inherited from wze::animatable
virtual ~animatable ()=default
 Default virtual destructor.
 
- Public Member Functions inherited from wze::component

Detailed Description

Definition at line 38 of file sprite.hpp.

Constructor & Destructor Documentation

◆ sprite()

wze::sprite::sprite ( float x = 0,
float y = 0,
float z = 0,
float angle = 0,
float width = 0,
float height = 0,
bool spatial = false,
std::shared_ptr< wze::texture > const & texture = {},
uint8_t color_r = std::numeric_limits<uint8_t>::max(),
uint8_t color_g = std::numeric_limits<uint8_t>::max(),
uint8_t color_b = std::numeric_limits<uint8_t>::max(),
uint8_t color_a = std::numeric_limits<uint8_t>::max(),
enum flip flip = FLIP_NONE,
bool visible = true,
uint8_t priority = std::numeric_limits<uint8_t>::max() / 2,
bool animated = true,
float x_offset = 0,
float y_offset = 0,
float angle_offset = 0,
bool attach_x = true,
bool attach_y = true,
bool attach_angle = true,
bool x_angle_lock = true,
bool y_angle_lock = true )
explicit

Definition at line 219 of file sprite.cpp.

227 {
228 set_x(x);
229 set_y(y);
230 set_z(z);
231 set_angle(angle);
232 set_width(width);
233 set_height(height);
234 set_spatial(spatial);
235 set_texture(texture);
236 set_color_r(color_r);
237 set_color_g(color_g);
238 set_color_b(color_b);
239 set_color_a(color_a);
240 set_flip(flip);
241 set_visible(visible);
242 set_priority(priority);
243 set_animated(animated);
244 set_x_offset(x_offset);
245 set_y_offset(y_offset);
246 set_angle_offset(angle_offset);
247 set_attach_x(attach_x);
248 set_attach_y(attach_y);
249 set_attach_angle(attach_angle);
250 set_x_angle_lock(x_angle_lock);
251 set_y_angle_lock(y_angle_lock);
252}
bool animated() const final
Gets whether the object should be animated.
Definition sprite.cpp:147
void set_texture(std::shared_ptr< wze::texture > const &texture) final
Sets the wze::texture of the object.
Definition sprite.cpp:87

Member Function Documentation

◆ x()

float wze::sprite::x ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 27 of file sprite.cpp.

27 {
28 return _x;
29}

◆ set_x()

void wze::sprite::set_x ( float x)
finalvirtual

Implements wze::component.

Definition at line 31 of file sprite.cpp.

31 {
32 _x = x;
33}

◆ y()

float wze::sprite::y ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 35 of file sprite.cpp.

35 {
36 return _y;
37}

◆ set_y()

void wze::sprite::set_y ( float y)
finalvirtual

Implements wze::component.

Definition at line 39 of file sprite.cpp.

39 {
40 _y = y;
41}

◆ z()

float wze::sprite::z ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 43 of file sprite.cpp.

43 {
44 return _z;
45}

◆ set_z()

void wze::sprite::set_z ( float z)

Definition at line 47 of file sprite.cpp.

47 {
48 _z = z;
49}

◆ angle()

float wze::sprite::angle ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 51 of file sprite.cpp.

51 {
52 return _angle;
53}

◆ set_angle()

void wze::sprite::set_angle ( float angle)
finalvirtual

Implements wze::component.

Definition at line 55 of file sprite.cpp.

55 {
56 _angle = angle;
57}

◆ width()

float wze::sprite::width ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 59 of file sprite.cpp.

59 {
60 return _width;
61}

◆ set_width()

void wze::sprite::set_width ( float width)

Definition at line 63 of file sprite.cpp.

63 {
64 _width = width;
65}

◆ height()

float wze::sprite::height ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 67 of file sprite.cpp.

67 {
68 return _height;
69}

◆ set_height()

void wze::sprite::set_height ( float height)

Definition at line 71 of file sprite.cpp.

71 {
72 _height = height;
73}

◆ spatial()

bool wze::sprite::spatial ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 75 of file sprite.cpp.

75 {
76 return _spatial;
77}

◆ set_spatial()

void wze::sprite::set_spatial ( bool spatial)

Definition at line 79 of file sprite.cpp.

79 {
80 _spatial = spatial;
81}

◆ texture()

std::shared_ptr< wze::texture > const & wze::sprite::texture ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 83 of file sprite.cpp.

83 {
84 return _texture;
85}

◆ set_texture()

void wze::sprite::set_texture ( std::shared_ptr< wze::texture > const & texture)
finalvirtual

Sets the wze::texture of the object.

Parameters
texturewze::texture of the object.

Implements wze::animatable.

Definition at line 87 of file sprite.cpp.

87 {
88 _texture = texture;
89}

◆ color_r()

uint8_t wze::sprite::color_r ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 91 of file sprite.cpp.

91 {
92 return _color_r;
93}

◆ set_color_r()

void wze::sprite::set_color_r ( uint8_t color_r)

Definition at line 95 of file sprite.cpp.

95 {
96 _color_r = color_r;
97}

◆ color_g()

uint8_t wze::sprite::color_g ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 99 of file sprite.cpp.

99 {
100 return _color_g;
101}

◆ set_color_g()

void wze::sprite::set_color_g ( uint8_t color_g)

Definition at line 103 of file sprite.cpp.

103 {
104 _color_g = color_g;
105}

◆ color_b()

uint8_t wze::sprite::color_b ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 107 of file sprite.cpp.

107 {
108 return _color_b;
109}

◆ set_color_b()

void wze::sprite::set_color_b ( uint8_t color_b)

Definition at line 111 of file sprite.cpp.

111 {
112 _color_b = color_b;
113}

◆ color_a()

uint8_t wze::sprite::color_a ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 115 of file sprite.cpp.

115 {
116 return _color_a;
117}

◆ set_color_a()

void wze::sprite::set_color_a ( uint8_t color_a)

Definition at line 119 of file sprite.cpp.

119 {
120 _color_a = color_a;
121}

◆ flip()

wze::flip wze::sprite::flip ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 123 of file sprite.cpp.

123 {
124 return _flip;
125}

◆ set_flip()

void wze::sprite::set_flip ( enum flip flip )

Definition at line 127 of file sprite.cpp.

127 {
128 _flip = flip;
129}

◆ visible()

bool wze::sprite::visible ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 131 of file sprite.cpp.

131 {
132 return _visible;
133}

◆ set_visible()

void wze::sprite::set_visible ( bool visible)

Definition at line 135 of file sprite.cpp.

135 {
136 _visible = visible;
137}

◆ priority()

uint8_t wze::sprite::priority ( ) const
nodiscardfinalvirtual

Implements wze::renderable.

Definition at line 139 of file sprite.cpp.

139 {
140 return _priority;
141}

◆ set_priority()

void wze::sprite::set_priority ( uint8_t priority)

Definition at line 143 of file sprite.cpp.

143 {
144 _priority = priority;
145}

◆ animated()

bool wze::sprite::animated ( ) const
nodiscardfinalvirtual

Gets whether the object should be animated.

Returns
Whether the object should be animated.

Implements wze::animatable.

Definition at line 147 of file sprite.cpp.

147 {
148 return _animated;
149}

◆ set_animated()

void wze::sprite::set_animated ( bool animated)

Definition at line 151 of file sprite.cpp.

151 {
152 _animated = animated;
153}

◆ x_offset()

float wze::sprite::x_offset ( ) const
nodiscardfinalvirtual

Implements wze::component.

Definition at line 155 of file sprite.cpp.

155 {
156 return _x_offset;
157}

◆ set_x_offset()

void wze::sprite::set_x_offset ( float x_offset)

Definition at line 159 of file sprite.cpp.

159 {
160 _x_offset = x_offset;
161}

◆ y_offset()

float wze::sprite::y_offset ( ) const
nodiscardfinalvirtual

Implements wze::component.

Definition at line 163 of file sprite.cpp.

163 {
164 return _y_offset;
165}

◆ set_y_offset()

void wze::sprite::set_y_offset ( float y_offset)

Definition at line 167 of file sprite.cpp.

167 {
168 _y_offset = y_offset;
169}

◆ angle_offset()

float wze::sprite::angle_offset ( ) const
nodiscardfinalvirtual

Implements wze::component.

Definition at line 171 of file sprite.cpp.

171 {
172 return _angle_offset;
173}

◆ set_angle_offset()

void wze::sprite::set_angle_offset ( float angle_offset)

Definition at line 175 of file sprite.cpp.

175 {
176 _angle_offset = angle_offset;
177}

◆ attach_x()

bool wze::sprite::attach_x ( ) const
nodiscardfinalvirtual

Implements wze::component.

Definition at line 179 of file sprite.cpp.

179 {
180 return _attach_x;
181}

◆ set_attach_x()

void wze::sprite::set_attach_x ( bool attach_x)

Definition at line 183 of file sprite.cpp.

183 {
184 _attach_x = attach_x;
185}

◆ attach_y()

bool wze::sprite::attach_y ( ) const
nodiscardfinalvirtual

Implements wze::component.

Definition at line 187 of file sprite.cpp.

187 {
188 return _attach_y;
189}

◆ set_attach_y()

void wze::sprite::set_attach_y ( bool attach_y)

Definition at line 191 of file sprite.cpp.

191 {
192 _attach_y = attach_y;
193}

◆ attach_angle()

bool wze::sprite::attach_angle ( ) const
nodiscardfinalvirtual

Implements wze::component.

Definition at line 195 of file sprite.cpp.

195 {
196 return _attach_angle;
197}

◆ set_attach_angle()

void wze::sprite::set_attach_angle ( bool attach_angle)

Definition at line 199 of file sprite.cpp.

199 {
200 _attach_angle = attach_angle;
201}

◆ x_angle_lock()

bool wze::sprite::x_angle_lock ( ) const
nodiscardfinalvirtual

Implements wze::component.

Definition at line 203 of file sprite.cpp.

203 {
204 return _x_angle_lock;
205}

◆ set_x_angle_lock()

void wze::sprite::set_x_angle_lock ( bool x_angle_lock)

Definition at line 207 of file sprite.cpp.

207 {
208 _x_angle_lock = x_angle_lock;
209}

◆ y_angle_lock()

bool wze::sprite::y_angle_lock ( ) const
nodiscardfinalvirtual

Implements wze::component.

Definition at line 211 of file sprite.cpp.

211 {
212 return _y_angle_lock;
213}

◆ set_y_angle_lock()

void wze::sprite::set_y_angle_lock ( bool y_angle_lock)

Definition at line 215 of file sprite.cpp.

215 {
216 _y_angle_lock = y_angle_lock;
217}

The documentation for this class was generated from the following files: