34 void setEnable(
const bool enable)
override { (void)enable; }
38 std::vector<ecs::Entity> enemiesToRemove;
49 if ((transform ==
nullptr) || (velocity ==
nullptr) || (rect ==
nullptr) || (texture ==
nullptr) ||
55 transform->x += velocity->
x * dt;
56 transform->y += velocity->
y * dt;
58 if (animation !=
nullptr)
60 animation->current_time += dt;
61 if (animation->current_time >= animation->frame_duration)
63 animation->current_time = 0.0F;
64 animation->current_frame = (animation->current_frame + 1) % animation->total_frames;
68 rect->pos_x =
static_cast<float>(frame_x);
69 rect->pos_y =
static_cast<float>(0);
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), rect->size_x,
83 enemiesToRemove.push_back(entity);
This file contains the component definitions.
Configuration constants for the multiplayer game.
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.
bool hasComponent(Entity e)
std::unordered_map< Entity, T > & getAll()
T * getComponent(Entity e)
void removeComponent(Entity e)
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
EnemySystem(const EnemySystem &)=delete
EnemySystem & operator=(EnemySystem &&)=delete
EnemySystem(const std::shared_ptr< eng::IRenderer > &renderer)
void setEnable(const bool enable) override
EnemySystem(EnemySystem &&)=delete
void update(ecs::Registry ®istry, const float dt) override
~EnemySystem() override=default
const std::shared_ptr< eng::IRenderer > & m_renderer
EnemySystem & operator=(const EnemySystem &)=delete
constexpr float SPRITE_WIDTH
constexpr float REMOVE_MIN_Y
constexpr float REMOVE_MAX_Y