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

System managing map state, scrolling, and transitions. More...

#include <MapSystem.hpp>

Inheritance diagram for ecs::MapSystem:
Inheritance graph
Collaboration diagram for ecs::MapSystem:
Collaboration graph

Public Member Functions

 MapSystem ()=default
 Default constructor.
 
 ~MapSystem () override=default
 Default destructor.
 
void update (Registry &registry, float deltaTime) override
 Updates map state and handles scrolling.
 
ComponentMask getComponentMask () const override
 Gets the component mask for this system.
 
- Public Member Functions inherited from ecs::ISystem
virtual ~ISystem ()=default
 Virtual destructor.
 

Private Member Functions

void _applyScrolling (Registry &registry, float scrollSpeed, float deltaTime)
 Apply scrolling to entities (moves them left based on map speed).
 

Detailed Description

System managing map state, scrolling, and transitions.

Handles:

  • Automatic horizontal scrolling of entities based on map speed
  • Map duration tracking and completion detection
  • Transition events when maps are completed
  • Background entity management

Works with entities that have MapData component.

Definition at line 28 of file MapSystem.hpp.

Constructor & Destructor Documentation

◆ MapSystem()

ecs::MapSystem::MapSystem ( )
default

Default constructor.

◆ ~MapSystem()

ecs::MapSystem::~MapSystem ( )
overridedefault

Default destructor.

Member Function Documentation

◆ _applyScrolling()

void ecs::MapSystem::_applyScrolling ( Registry registry,
float  scrollSpeed,
float  deltaTime 
)
private

Apply scrolling to entities (moves them left based on map speed).

Parameters
registryReference to the ECS registry
scrollSpeedHorizontal scroll speed in pixels/second
deltaTimeTime elapsed since last frame

Definition at line 58 of file MapSystem.cpp.

References ecs::Registry::getComponent(), ecs::Registry::getEntitiesWithMask(), ecs::Transform::getPosition(), and ecs::Registry::hasComponent().

Referenced by update().

Here is the call graph for this function:

◆ getComponentMask()

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

Gets the component mask for this system.

Returns
ComponentMask requiring MapData component

Implements ecs::ISystem.

Definition at line 78 of file MapSystem.cpp.

Referenced by update().

◆ update()

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

Updates map state and handles scrolling.

  • Updates elapsed time on active maps
  • Applies scrolling to all entities with Transform (except players)
  • Detects map completion based on duration
Parameters
registryReference to the ECS registry
deltaTimeTime elapsed since last frame (in seconds)

Implements ecs::ISystem.

Definition at line 14 of file MapSystem.cpp.

References _applyScrolling(), ecs::Registry::getComponent(), getComponentMask(), ecs::Registry::getEntitiesWithMask(), LOG_INFO, and ecs::MapData::updateElapsedTime().

Here is the call graph for this function:

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