#include "MovementSystem.h"
#include "components/Direction.h"
#include "components/Position.h"

void MovementSystem::update(entityx::EntityManager &es,
                            entityx::EventManager &events,
                            entityx::TimeDelta dt)
{
    for (entityx::Entity entity : es.entities_with_components<Position, Direction>())
    {
        entityx::ComponentHandle<Position> position = entity.component<Position>();
        entityx::ComponentHandle<Direction> direction = entity.component<Direction>();
        position.get()->x += direction.get()->x * dt;
        position.get()->y += direction.get()->y * dt;
    }
}