/********************\ | Copyright 2024, | | Ulysse Cura | \********************/ //////////////////////////////////////////////////// // // // Composant de transformation, sert a donner // // une position, dimension, etc... à une entitée. // // // //////////////////////////////////////////////////// #ifndef TRANSFORM_HPP #define TRANSFORM_HPP #include "ECS.hpp" #include "../Vector2D.hpp" struct TransformComponent : public Component { TransformComponent() { position.zero(); } TransformComponent(Vector2D pos, Vector2D dim, int sc, int spd) : position(pos), speed(spd), dimension(dim), scale(sc) {} void init() override { velocity.zero(); } void update() override { position += (velocity * static_cast(speed)); entity->draw_priority = static_cast(position.y + static_cast(dimension.y * scale)); } Vector2D position; Vector2D velocity; int speed {1}; Vector2D dimension {32, 32}; int scale {1}; }; #endif