Entityx usage and fixed release types
This commit is contained in:
16
src/entities/MovementSystem.cpp
Normal file
16
src/entities/MovementSystem.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user