jubilant-funicular
|
A 2D Animation made from a single SpriteSheet. More...
#include <Animation2D.h>
Public Member Functions | |
Animation2D (const SpriteSheet &sheet, std::size_t start=0, std::size_t length=1, float speed=1) | |
Animation2D (ContextData &context, crstring file_path, crivec2 dims, std::size_t start=0, std::size_t length=1, float speed=1) | |
Animation2D (ContextData &context, crstring file_path, int num_cols, std::size_t start=0, std::size_t length=1, float speed=1) | |
glm::vec4 | get_uv () const |
glm::vec4 | get_flipped_uv () const |
glm::vec2 | get_frame_dims () const |
std::size_t | get_index () const |
std::size_t | get_start () const |
std::size_t | get_length () const |
float | get_speed () const |
GLuint | get_tex_id () const |
float | get_time () const |
void | switch_animation (std::size_t start, std::size_t length, float speed=1) |
void | set_speed (float speed) |
void | reset_time () |
void | step (float dt) |
Private Attributes | |
SpriteSheet | m_sheet |
The sheet holding the sprites used by the animation. | |
float | m_time |
float | m_speed |
how quickly the animation advances when step is called | |
std::size_t | m_start_index |
A single animation spans m_length continuous sprite indices beginning with m_start_index. | |
std::size_t | m_length |
A 2D Animation made from a single SpriteSheet.
Definition at line 67 of file Animation2D.h.
|
private |
how far along in the animation we are. Essentially only defined modulo m_length
Definition at line 73 of file Animation2D.h.