32 void setEnable(
bool enable)
override { (void)enable; }
36 std::vector<ecs::Entity> enemiesToRemove;
48 if (!transform || !velocity || !rect || !texture || !scale)
52 transform->x += velocity->
x * dt;
53 transform->y += velocity->
y * dt;
58 animation->current_time += dt;
59 if (animation->current_time >= animation->frame_duration)
61 animation->current_time = 0.0f;
62 animation->current_frame = (animation->current_frame + 1) % animation->total_frames;
66 const int frame_y = 0;
67 rect->pos_x =
static_cast<float>(frame_x);
68 rect->pos_y =
static_cast<float>(frame_y);
74 std::round(transform->x), std::round(transform->y), scale->x, scale->y,
75 static_cast<int>(rect->pos_x),
static_cast<int>(rect->pos_y),
76 static_cast<int>(rect->size_x),
static_cast<int>(rect->size_y));
83 enemiesToRemove.push_back(entity);
This file contains the component definitions.
Configuration constants for the game.
This file contains the IRenderer class declaration.
This file contains the Registry class declaration.
EnemySystem & operator=(EnemySystem &&)=delete
void update(ecs::Registry ®istry, float dt) override
void setEnable(bool enable) override
EnemySystem(const EnemySystem &)=delete
eng::IRenderer & m_renderer
EnemySystem(eng::IRenderer &renderer)
~EnemySystem() override=default
EnemySystem & operator=(const EnemySystem &)=delete
EnemySystem(EnemySystem &&)=delete
Class for managing entities and their components.
bool hasComponent(Entity e)
std::unordered_map< Entity, T > & getAll()
T * getComponent(Entity e)
void removeComponent(Entity e)
Interface for the renderer.
virtual void drawSprite(const std::string &name)=0
virtual void createSprite(const std::string &name, const std::string &textureName, float x, float y, float scale_x=1, float scale_y=1, int fx=0, int fy=0, int fnx=-1, int fny=-1)=0
constexpr float SPRITE_WIDTH
constexpr float REMOVE_MIN_Y
constexpr float REMOVE_MAX_Y