1#ifndef NNGN_ANIMATION_H
2#define NNGN_ANIMATION_H
26 enum class Type : uint8_t {
34 std::uniform_real_distribution<float>
rnd_f;
35 std::array<std::uniform_real_distribution<float>, 3>
rnd_3f;
51 std::array<vec2, 2>
uv;
54 using Track = std::vector<Frame>;
55 using Group = std::vector<Track>;
57 std::shared_ptr<const Group>
m_group = {};
59 std::chrono::microseconds
timer = {};
66 const Frame *
cur()
const;
78 float *
a,
bool *updated);
84 std::vector<SpriteAnimation>
sprite = {};
85 std::vector<LightAnimation>
light = {};
89 size_t max_sprite()
const {
return this->sprite.capacity(); }
90 size_t max_light()
const {
return this->light.capacity(); }
92 size_t n_sprite()
const {
return this->sprite.size(); }
93 size_t n_light()
const {
return this->light.size(); }
Definition animation.h:24
Type type
Definition animation.h:30
linear_t linear
Definition animation.h:33
std::uniform_real_distribution< float > rnd_f
Definition animation.h:34
AnimationFunction() noexcept
Definition animation.h:38
bool done() const
Definition animation.cpp:112
Type
Definition animation.h:26
std::array< std::uniform_real_distribution< float >, 3 > rnd_3f
Definition animation.h:35
Definition animation.h:82
size_t max_sprite() const
Definition animation.h:89
std::vector< SpriteAnimation > sprite
Definition animation.h:84
size_t n_sprite() const
Definition animation.h:92
void init(Math *m)
Definition animation.h:87
size_t n() const
Definition animation.h:91
std::vector< LightAnimation > light
Definition animation.h:85
void remove(Animation *p)
Definition animation.cpp:211
void set_max(size_t n)
Definition animation.cpp:206
size_t max() const
Definition animation.h:88
size_t max_light() const
Definition animation.h:90
size_t n_light() const
Definition animation.h:93
Math * math
Definition animation.h:83
Definition animation.h:71
std::chrono::milliseconds timer
Definition animation.h:72
AnimationFunction f
Definition animation.h:73
std::chrono::milliseconds rate
Definition animation.h:72
Definition animation.h:48
size_t m_cur_track
Definition animation.h:58
std::shared_ptr< const Group > m_group
Definition animation.h:57
void set_track(size_t index)
Definition animation.cpp:140
std::vector< Frame > Track
Definition animation.h:54
auto cur_track() const
Definition animation.h:64
const Frame * cur() const
Definition animation.cpp:134
bool updated
Definition animation.h:60
size_t cur_frame
Definition animation.h:58
std::chrono::microseconds timer
Definition animation.h:59
std::vector< Track > Group
Definition animation.h:55
auto track_count() const
Definition animation.h:65
update
Definition img_common.lua:42
local rnd
Definition players.lua:9
load
Definition entity.lua:7
Definition animation.h:31
float end
Definition animation.h:31
float step_s
Definition animation.h:31
float v
Definition animation.h:31
Definition animation.h:44
Entity * entity
Definition animation.h:45
Definition animation.h:50
std::array< vec2, 2 > uv
Definition animation.h:51
std::chrono::milliseconds duration
Definition animation.h:52
Non-owning reference to a table on the stack.
Definition table.h:166
Operations on table values.