22 animation.elapsed += std::max(seconds, 0.0F);
23 const float duration = animation.duration();
24 if (duration > 0.0F) {
25 animation.elapsed = animation.loop ? std::fmod(animation.elapsed, duration)
26 : std::min(animation.elapsed, duration);
28 return animation.frame();
40 const float delta = tick.
delta();
60 destroyed.push_back(entity);
63 for (
const Entity entity : destroyed) {
Handle to an entity: 32 bits made of a 24-bit index and an 8-bit generation.
Definition entity.hpp:23
Entry point of the ECS: creates entities and stores their components.
Definition registry.hpp:34
bool destroy(Entity entity)
Destroys an entity and removes all its components.
View< Components... > view()
View on the entities that own all the listed components.
Definition registry.hpp:222
Components shared by the client and the server.
Entity-Component-System used by client and server.
Definition animation.hpp:13
void destroy_finished_animations(Registry ®istry, std::vector< Entity > &destroyed)
Destroys the effects whose animation has played to the end.
Definition animation.hpp:55
void animate_sprites(Registry ®istry, const Tick &tick)
Advances every animation by one tick and shows its frame.
Definition animation.hpp:39
std::uint32_t advance(Animation &animation, float seconds) noexcept
Moves an animation forward and tells which frame it shows.
Definition animation.hpp:21
Registry: owns the entities and one component pool per component type.
Frames of the entity's Sprite shown in turn, at a steady rate.
Definition components.hpp:56
constexpr bool finished() const noexcept
Tells whether a clip that does not loop has shown its last frame long enough.
Definition components.hpp:91
Entity destroyed once its Animation has played to the end: a visual effect that lasts as long as its ...
Definition components.hpp:209
What an entity looks like.
Definition components.hpp:34
std::uint32_t frame
Frame of the texture's sprite sheet, 0 for the first (or only) frame.
Definition components.hpp:41
One simulation step, as the systems see it.
Definition system.hpp:23
constexpr float delta() const noexcept
Duration of the step in seconds, to scale values given per second.
Definition system.hpp:32
Systems and the scheduler that updates them in order, once per tick.