104 [[nodiscard]]
int state()
const;
132 void AddState(
int row,
int steps,
int speed,
float frame_width,
float frame_height);
The SpriteAnimated class enables frame-by-frame animations by displaying only a certain section of a ...
void Update() override
Updates the animation state of the sprite.
int state_
Stores the id of the current state.
std::vector< anim_state > states_
Vector that holds the individual state structs.
int current_step_
Internal animation cycle step counter.
void AddState(int row, int steps, int speed, float frame_width, float frame_height)
Adds a new animation state.
void nextState(int nextState)
Switch to another animation state by its id. The switch will happen after the last animation cycle is...
bool update_if_invisible
Defines whether the animation should be updated also if the sprite is not visible....
int next_state_
The id of the next state. The switch will happen after the current animation cycle is completed.
The Sprite class specifies position and degree of rotation on the screen for an associated VRAM textu...
const ::Texture2D & texture() const
float rotation
The sprites rotation angle. Default is 0.
int pos_x
The sprites x position.
int pos_y
The sprites y position.
This structure contains all data necessary for the description of the frame-by-frame animation.
float frame_height
Height of a single animation frame.
int row
y-offset measured in rows (depending on the frame height, i.e. row 1 has a y-offset of 0px,...
int steps
Number of steps of the animation.
float frame_width
Width of a single animation frame.
int speed
Speed of the frame-by-frame animation.