galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Animated.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_COMPONENTS_ANIMATED_HPP_
9#define GALAXY_COMPONENTS_ANIMATED_HPP_
10
12#include "galaxy/graphics/anim/Animation.hpp"
13
14namespace galaxy
15{
16 namespace components
17 {
21 class Animated final : public fs::Serializable
22 {
23 public:
27 Animated();
28
34 Animated(const nlohmann::json& json);
35
40
45
49 virtual ~Animated();
50
56 void set_animation(const std::string& animation);
57
63 [[nodiscard]]
64 nlohmann::json serialize() override;
65
71 void deserialize(const nlohmann::json& json) override;
72
73 private:
77 Animated(const Animated&) = delete;
78
82 Animated& operator=(const Animated&) = delete;
83
84 public:
89
93 double m_duration;
94
98 graphics::Animation* m_anim;
99 };
100 } // namespace components
101} // namespace galaxy
102
103#endif
Allows for an entity to be animated.
Definition Animated.hpp:22
virtual ~Animated()
Destructor.
Definition Animated.cpp:57
graphics::Animation * m_anim
Animation object.
Definition Animated.hpp:98
Animated & operator=(Animated &&)
Move assignment operator.
Definition Animated.cpp:43
Animated & operator=(const Animated &)=delete
Copy assignment operator.
void set_animation(const std::string &animation)
Sets the active animation.
Definition Animated.cpp:62
double m_duration
Time spent on current frame.
Definition Animated.hpp:93
bool m_paused
Is the animation paused.
Definition Animated.hpp:88
Animated(const Animated &)=delete
Copy constructor.
void deserialize(const nlohmann::json &json) override
Deserializes from object.
Definition Animated.cpp:87
nlohmann::json serialize() override
Serializes object.
Definition Animated.cpp:68
Allows a class to be serialized.
Timer.hpp galaxy.
Definition Async.hpp:17