Moving components and systems out of the ecs

This commit is contained in:
Zoe Roux
2021-05-24 15:23:20 +02:00
103 changed files with 7248 additions and 64 deletions

View File

@@ -0,0 +1,28 @@
//
// Created by Zoe Roux on 5/17/21.
//
#include "Component/Position/PositionComponent.hpp"
#include "MovableSystem.hpp"
#include "Component/Movable/MovableComponent.hpp"
#include "Wal.hpp"
namespace Bomberman
{
MovableSystem::MovableSystem()
: System({
typeid(MovableComponent),
typeid(PositionComponent)
})
{}
void MovableSystem::onFixedUpdate(WAL::Entity &entity)
{
auto &movable = entity.getComponent<MovableComponent>();
auto &position = entity.getComponent<PositionComponent>();
position.position += movable._velocity * WAL::Wal::timestep.count();
movable._velocity = movable._acceleration * WAL::Wal::timestep.count();
movable._acceleration = Vector3f();
}
}