![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
2D animation information. More...
#include <Animation.hpp>
Public Member Functions | |
Animation () | |
Constructor. | |
Animation (Animation &&) | |
Move constructor. | |
Animation & | operator= (Animation &&) |
Move assignment operator. | |
Animation (const Animation &) | |
Copy constructor. | |
Animation & | operator= (const Animation &) |
Copy assignment operator. | |
~Animation () | |
Destructor. | |
bool | load (const std::string &file) |
Load a json file from VFS and set frames from that. | |
void | set_frames (const nlohmann::json &json) |
Loads frames from json object. | |
void | set_frames (const meta::vector< Frame > &frames) |
Set from an existing vector of frames. | |
void | next () |
Advance to the next frame. | |
void | prev () |
Go back to the previous frame. | |
void | restart () |
Sets animation back to beginning. | |
Frame & | current () |
Get currently active frame. | |
std::size_t | total () const |
Get total frames. | |
std::size_t | index () const |
Get current frame index. | |
meta::vector< Frame > & | frames () |
Get the frames. | |
Public Attributes | |
double | m_speed |
Speed of the animation. Multiplier, so 1.0f is regular speed. | |
std::string | m_name |
Animation name. | |
Private Attributes | |
std::size_t | m_index |
Index of the current active frame. | |
meta::vector< Frame > | m_frames |
Frames belonging to this animation. | |
2D animation information.
Definition at line 27 of file Animation.hpp.
galaxy::graphics::Animation::Animation | ( | ) |
Constructor.
Definition at line 19 of file Animation.cpp.
galaxy::graphics::Animation::Animation | ( | Animation && | a | ) |
Move constructor.
Definition at line 25 of file Animation.cpp.
galaxy::graphics::Animation::Animation | ( | const Animation & | a | ) |
Copy constructor.
Definition at line 46 of file Animation.cpp.
galaxy::graphics::Animation::~Animation | ( | ) |
Destructor.
Definition at line 67 of file Animation.cpp.
Move assignment operator.
Definition at line 33 of file Animation.cpp.
Copy assignment operator.
Definition at line 54 of file Animation.cpp.
|
nodiscard |
Load a json file from VFS and set frames from that.
file | File in VFS. JSON file must be an array. |
Definition at line 71 of file Animation.cpp.
void galaxy::graphics::Animation::set_frames | ( | const nlohmann::json & | json | ) |
Loads frames from json object.
json | Must be an array of json objects. |
Definition at line 88 of file Animation.cpp.
void galaxy::graphics::Animation::set_frames | ( | const meta::vector< Frame > & | frames | ) |
Set from an existing vector of frames.
frames | List of frames to use for this animation. |
Definition at line 101 of file Animation.cpp.
void galaxy::graphics::Animation::next | ( | ) |
Advance to the next frame.
Definition at line 106 of file Animation.cpp.
void galaxy::graphics::Animation::prev | ( | ) |
Go back to the previous frame.
Definition at line 116 of file Animation.cpp.
void galaxy::graphics::Animation::restart | ( | ) |
Sets animation back to beginning.
Definition at line 126 of file Animation.cpp.
|
nodiscard |
Get currently active frame.
Definition at line 131 of file Animation.cpp.
|
nodiscard |
Get total frames.
Definition at line 136 of file Animation.cpp.
|
nodiscard |
Get current frame index.
Definition at line 141 of file Animation.cpp.
|
nodiscard |
Get the frames.
Definition at line 146 of file Animation.cpp.
double galaxy::graphics::Animation::m_speed |
Speed of the animation. Multiplier, so 1.0f is regular speed.
Definition at line 136 of file Animation.hpp.
std::string galaxy::graphics::Animation::m_name |
Animation name.
Definition at line 141 of file Animation.hpp.
|
private |
Index of the current active frame.
Definition at line 147 of file Animation.hpp.
|
private |
Frames belonging to this animation.
Definition at line 152 of file Animation.hpp.