![]() |
Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
|
#include <definitions.hpp>
Public Member Functions | |
| Animation (std::string _name="Animation", int _fps=30, Vector2 _size={0, 0}, bool _loop=true, bool _autoplay=false) | |
| template<typename... Args> | |
| void | addFrames (Args... frames) |
| template<class Archive > | |
| void | save (Archive &ar) const |
| template<class Archive > | |
| void | load (Archive &ar) |
Public Attributes | |
| std::string | name |
| int | fps = 15 |
| std::vector< Frame > | frames |
| std::string | texturePath |
| TextureScaling | textureScaling |
| Vector2 | size |
| bool | loop = true |
| bool | autoplay = false |
The Animation component represents a series of Frame ["Frames"]. It is used with AnimatedSprite ["AnimatedSprites"].
Example usage:
For an animation to work on an AnimatedSprite, you must set it's texturePath:
Instead of directly storing a texture, Animations only store the path and scaling of the texture. The texture is eventually loaded when playing the animation to save on memory.
You can also define the TextureScaling type:
Make sure to also check out the animated sprite example!
|
inline |
|
inline |
|
inline |
|
inline |
| bool Animation::autoplay = false |
| int Animation::fps = 15 |
| std::vector<Frame> Animation::frames |
| bool Animation::loop = true |
| std::string Animation::name |
| Vector2 Animation::size |
| std::string Animation::texturePath |
| TextureScaling Animation::textureScaling |