Loading...
Searching...
No Matches
MovementSystem.h
Go to the documentation of this file.
1//
2// Created by Dave Smith on 3/11/25.
3//
4
5#ifndef MOVEMENTSYSTEM_H
6#define MOVEMENTSYSTEM_H
7
8#pragma once
9
10#include <unordered_map>
11#include <vector>
12
13#include "Core/ECSManager.h"
15namespace ml
16{
22 {
23 public:
24 static void update(ECSManager &ecs, const float deltaTime)
25 {
26 for (auto &[entity, velocity] : ecs.velocities)
27 {
28 if (ecs.positions.find(entity) != ecs.positions.end())
29 {
30 ecs.positions[entity].x += velocity.vx * deltaTime;
31 ecs.positions[entity].y += velocity.vy * deltaTime;
32 }
33 }
34 }
35 };
36}
37#endif // MOVEMENTSYSTEM_H
ECSManager.
Definition ECSManager.h:23
std::unordered_map< Entity, PositionComponent > positions
Definition ECSManager.h:25
std::unordered_map< Entity, VelocityComponent > velocities
Definition ECSManager.h:26
MovementSystem.
static void update(ECSManager &ecs, const float deltaTime)
Definition Component.h:18