9#ifndef GALAXY_GRAPHICS_ANIM_ANIMATION_HPP_
10#define GALAXY_GRAPHICS_ANIM_ANIMATION_HPP_
12#include <nlohmann/json_fwd.hpp>
15#include "galaxy/meta/Memory.hpp"
68 bool load(
const std::string& file);
113 std::size_t
total()
const;
121 std::size_t
index()
const;
129 meta::vector<Frame>&
frames();
2D animation information.
double m_speed
Speed of the animation. Multiplier, so 1.0f is regular speed.
void prev()
Go back to the previous frame.
bool load(const std::string &file)
Load a json file from VFS and set frames from that.
std::size_t index() const
Get current frame index.
meta::vector< Frame > & frames()
Get the frames.
std::size_t m_index
Index of the current active frame.
Animation & operator=(Animation &&)
Move assignment operator.
void set_frames(const nlohmann::json &json)
Loads frames from json object.
std::string m_name
Animation name.
std::size_t total() const
Get total frames.
void restart()
Sets animation back to beginning.
meta::vector< Frame > m_frames
Frames belonging to this animation.
void next()
Advance to the next frame.
Frame & current()
Get currently active frame.
Single frame of an animation.