24 std::string spriteName;
25 spriteName.reserve(64);
33 if (!transform || !rect || !texture)
38 animation.current_time += dt;
39 if (animation.current_time >= animation.frame_duration)
41 animation.current_time = 0.0f;
42 animation.current_frame = (animation.current_frame + 1) % animation.total_frames;
44 const int frame_x = (animation.current_frame % animation.frames_per_row) *
45 static_cast<int>(animation.frame_width);
46 const int frame_y = (animation.current_frame / animation.frames_per_row) *
47 static_cast<int>(animation.frame_height);
49 rect->pos_x =
static_cast<float>(frame_x);
50 rect->pos_y =
static_cast<float>(frame_y);
54 spriteName = texture->
id;
55 spriteName += std::to_string(entity);
60 rect->size_x, rect->size_y);
This file contains the component definitions.
This file contains the IRenderer class declaration.
This file contains the interface for systems.
This file contains the Registry class declaration.
Abstract class for system.
Class for managing entities and their components.
std::unordered_map< Entity, T > & getAll()
T * getComponent(Entity e)
virtual void drawSprite(const std::string &name)=0
virtual void setSpritePosition(const std::string &name, float x, float y)=0
virtual void setSpriteTexture(const std::string &name, const std::string &path)=0
virtual void setSpriteFrame(const std::string &name, int fx, int fy, int fnx, int fny)=0
LoadingAnimationSystem(LoadingAnimationSystem &&)=delete
LoadingAnimationSystem(const std::shared_ptr< eng::IRenderer > &renderer)
const std::shared_ptr< eng::IRenderer > & m_renderer
void update(ecs::Registry ®istry, float dt) override
LoadingAnimationSystem & operator=(const LoadingAnimationSystem &)=delete
~LoadingAnimationSystem() override=default
LoadingAnimationSystem & operator=(const LoadingAnimationSystem &&)=delete
LoadingAnimationSystem(const LoadingAnimationSystem &)=delete