R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
ecs::MovementSystem Class Reference

System handling entity movement based on velocity. More...

#include <MovementSystem.hpp>

Inheritance diagram for ecs::MovementSystem:
Inheritance graph
Collaboration diagram for ecs::MovementSystem:
Collaboration graph

Public Member Functions

 MovementSystem ()=default
 Default constructor.
 
 ~MovementSystem () override=default
 Default destructor.
 
void update (Registry &registry, float deltaTime) override
 Updates entity positions based on their velocities.
 
ComponentMask getComponentMask () const override
 Gets the component mask for this system.
 
- Public Member Functions inherited from ecs::ISystem
virtual ~ISystem ()=default
 Virtual destructor.
 

Detailed Description

System handling entity movement based on velocity.

Updates entity positions by applying their velocity and speed. Requires Transform and Velocity components.

Definition at line 23 of file MovementSystem.hpp.

Constructor & Destructor Documentation

◆ MovementSystem()

ecs::MovementSystem::MovementSystem ( )
default

Default constructor.

◆ ~MovementSystem()

ecs::MovementSystem::~MovementSystem ( )
overridedefault

Default destructor.

Member Function Documentation

◆ getComponentMask()

ComponentMask ecs::MovementSystem::getComponentMask ( ) const
overridevirtual

Gets the component mask for this system.

Returns
ComponentMask requiring Transform and Velocity components

Implements ecs::ISystem.

Definition at line 31 of file MovementSystem.cpp.

Referenced by update().

◆ update()

void ecs::MovementSystem::update ( Registry registry,
float  deltaTime 
)
overridevirtual

Updates entity positions based on their velocities.

Applies velocity to transform positions for all moving entities.

Applies velocity vectors and speed to transform positions. Movement is frame-rate independent using deltaTime.

Parameters
registryReference to the ECS registry
deltaTimeTime elapsed since last frame (in seconds)

Implements ecs::ISystem.

Definition at line 14 of file MovementSystem.cpp.

References ecs::Registry::getComponent(), getComponentMask(), ecs::Registry::getEntitiesWithMask(), ecs::Transform::getPosition(), and ecs::Transform::Vector2::x.

Here is the call graph for this function:

The documentation for this class was generated from the following files: