22 #include "stage_node.h"
25 #include "../interfaces.h"
26 #include "../generic/managed.h"
27 #include "../generic/identifiable.h"
29 #include "../animation.h"
30 #include "../macros.h"
34 class KeyFrameAnimationState;
40 uint32_t padding_vertical = 0;
41 uint32_t padding_horizontal = 0;
53 using ContainerNode::_get_renderables;
56 void clean_up()
override;
57 void update(
float dt)
override;
59 void destroy()
override;
60 void destroy_immediately()
override;
64 void set_render_dimensions(
float width,
float height);
65 void set_render_dimensions_from_width(
float width);
66 void set_render_dimensions_from_height(
float height);
68 void set_render_priority(smlt::RenderPriority priority);
70 void set_alpha(
float alpha);
72 float alpha()
const {
return alpha_; }
73 MaterialID material_id()
const {
return material_id_; }
78 uint32_t frame_height,
82 void flip_vertically(
bool value=
true);
83 void flip_horizontally(
bool value=
true);
85 const AABB& aabb()
const override;
89 float frame_width_ = 0;
90 float frame_height_ = 0;
91 float sprite_sheet_margin_ = 0;
92 float sprite_sheet_spacing_ = 0;
93 std::pair<uint32_t, uint32_t> sprite_sheet_padding_;
94 float render_width_ = 1.0;
95 float render_height_ = 1.0;
103 float image_width_ = 0;
104 float image_height_ = 0;
108 void update_texture_coordinates();
110 bool flipped_vertically_ =
false;
111 bool flipped_horizontally_ =
false;
113 void refresh_animation_state(uint32_t current_frame, uint32_t next_frame,
float interp) {
114 _S_UNUSED(current_frame);
115 _S_UNUSED(next_frame);
118 update_texture_coordinates();
121 std::shared_ptr<KeyFrameAnimationState> animation_state_;
125 Property<decltype(&Sprite::animation_state_)> animations = {
this, &Sprite::animation_state_};