|
R-Type
Distributed multiplayer game engine in C++
|
Component storing information about the current map/level. More...
#include <MapData.hpp>


Public Member Functions | |
| MapData () | |
| Default constructor. Initializes with empty map data. | |
| MapData (const std::string &mapId, float scrollSpeed, const std::string &backgroundSprite, const std::string &spawnScript) | |
| Constructor with basic parameters. | |
| MapData (const std::string &mapId, const std::string &name, float scrollSpeed, const std::string &backgroundSprite, const std::string &spawnScript, float duration, const std::string &nextMapId, const std::string ¶llaxBackground="", float parallaxSpeedFactor=0.5f) | |
| Full constructor with all parameters. | |
| ~MapData () override=default | |
| const std::string & | getMapId () const |
| Get the map unique identifier. | |
| const std::string & | getName () const |
| Get the map display name. | |
| float | getScrollSpeed () const |
| Get the scroll speed. | |
| const std::string & | getBackgroundSprite () const |
| Get the background sprite path. | |
| const std::string & | getParallaxBackgroundSprite () const |
| Get the parallax background sprite path. | |
| float | getParallaxSpeedFactor () const |
| Get the parallax speed factor. | |
| const std::string & | getSpawnScript () const |
| Get the spawn script path. | |
| float | getDuration () const |
| Get the map duration. | |
| const std::string & | getNextMapId () const |
| Get the next map ID. | |
| float | getElapsedTime () const |
| Get the elapsed time on this map. | |
| bool | isCompleted () const |
| Check if the map is completed. | |
| void | setMapId (const std::string &mapId) |
| Set the map ID. | |
| void | setName (const std::string &name) |
| Set the map name. | |
| void | setScrollSpeed (float speed) |
| Set the scroll speed. | |
| void | setBackgroundSprite (const std::string &sprite) |
| Set the background sprite. | |
| void | setParallaxBackgroundSprite (const std::string &sprite) |
| Set the parallax background sprite. | |
| void | setParallaxSpeedFactor (float factor) |
| Set the parallax speed factor. | |
| void | setSpawnScript (const std::string &script) |
| Set the spawn script. | |
| void | setDuration (float duration) |
| Set the map duration. | |
| void | setNextMapId (const std::string &nextMapId) |
| Set the next map ID. | |
| void | updateElapsedTime (float deltaTime) |
| Update the elapsed time. | |
| void | markCompleted () |
| Mark the map as completed. | |
| void | reset () |
| Reset the map state (elapsed time and completion). | |
| ComponentType | getType () const override |
| Get the component type ID. | |
Public Member Functions inherited from ecs::IComponent | |
| virtual | ~IComponent ()=default |
| Virtual destructor. | |
Private Attributes | |
| std::string | _mapId |
| Unique map identifier. | |
| std::string | _name |
| Display name. | |
| float | _scrollSpeed |
| Horizontal scroll speed (px/s) | |
| std::string | _backgroundSprite |
| Background asset path. | |
| std::string | _parallaxBackgroundSprite |
| Parallax layer asset path (rendered on top, scrolls slower) | |
| float | _parallaxSpeedFactor |
| Speed factor for parallax layer (0.5 = half speed) | |
| std::string | _spawnScript |
| Lua script for spawn logic. | |
| float | _duration |
| Map duration in seconds (0 = infinite) | |
| std::string | _nextMapId |
| Next map to load after completion. | |
| float | _elapsedTime |
| Time spent on this map. | |
| bool | _isCompleted |
| Completion flag. | |
Component storing information about the current map/level.
Contains all data needed to configure and manage a game map, including scrolling speed, background assets, spawn script, and custom metadata.
This component is typically attached to a singleton entity that manages the active map state.
Definition at line 24 of file MapData.hpp.
|
inline |
Default constructor. Initializes with empty map data.
Definition at line 30 of file MapData.hpp.
|
inline |
Constructor with basic parameters.
| mapId | Unique identifier for this map |
| scrollSpeed | Horizontal scroll speed (pixels/second) |
| backgroundSprite | Background sprite asset path |
| spawnScript | Lua script path for spawn management |
Definition at line 50 of file MapData.hpp.
|
inline |
Full constructor with all parameters.
| mapId | Unique identifier for this map |
| name | Display name of the map |
| scrollSpeed | Horizontal scroll speed (pixels/second) |
| backgroundSprite | Background sprite asset path |
| spawnScript | Lua script path for spawn management |
| duration | Map duration in seconds (0 = infinite) |
| nextMapId | ID of the next map to load after completion |
| parallaxBackground | Parallax layer sprite (rendered on top, scrolls slower) |
| parallaxSpeedFactor | Speed factor for parallax layer (0.5 = half speed) |
Definition at line 76 of file MapData.hpp.
|
overridedefault |
|
inline |
Get the background sprite path.
Definition at line 118 of file MapData.hpp.
References _backgroundSprite.
|
inline |
Get the map duration.
Definition at line 142 of file MapData.hpp.
References _duration.
Referenced by server::GameLogic::loadMap().
|
inline |
Get the elapsed time on this map.
Definition at line 154 of file MapData.hpp.
References _elapsedTime.
|
inline |
Get the map unique identifier.
Definition at line 100 of file MapData.hpp.
References _mapId.
Referenced by server::GameLogic::loadMap().
|
inline |
Get the map display name.
Definition at line 106 of file MapData.hpp.
References _name.
Referenced by server::GameLogic::loadMap().
|
inline |
Get the next map ID.
Definition at line 148 of file MapData.hpp.
References _nextMapId.
|
inline |
Get the parallax background sprite path.
Definition at line 124 of file MapData.hpp.
References _parallaxBackgroundSprite.
|
inline |
Get the parallax speed factor.
Definition at line 130 of file MapData.hpp.
References _parallaxSpeedFactor.
|
inline |
Get the scroll speed.
Definition at line 112 of file MapData.hpp.
References _scrollSpeed.
Referenced by server::GameLogic::loadMap().
|
inline |
Get the spawn script path.
Definition at line 136 of file MapData.hpp.
References _spawnScript.
Referenced by server::GameLogic::loadMap().
|
inlineoverridevirtual |
Get the component type ID.
Implements ecs::IComponent.
Definition at line 241 of file MapData.hpp.
|
inline |
Check if the map is completed.
Definition at line 160 of file MapData.hpp.
References _isCompleted.
|
inline |
|
inline |
Reset the map state (elapsed time and completion).
Definition at line 232 of file MapData.hpp.
References _elapsedTime, and _isCompleted.
|
inline |
Set the background sprite.
| sprite | New background sprite path |
Definition at line 186 of file MapData.hpp.
References _backgroundSprite.
|
inline |
Set the map duration.
| duration | New duration in seconds |
Definition at line 210 of file MapData.hpp.
References _duration.
|
inline |
Set the map ID.
| mapId | New map ID |
Definition at line 168 of file MapData.hpp.
References _mapId.
|
inline |
Set the map name.
| name | New map name |
Definition at line 174 of file MapData.hpp.
References _name.
|
inline |
Set the next map ID.
| nextMapId | New next map ID |
Definition at line 216 of file MapData.hpp.
References _nextMapId.
|
inline |
Set the parallax background sprite.
| sprite | New parallax background sprite path |
Definition at line 192 of file MapData.hpp.
References _parallaxBackgroundSprite.
|
inline |
Set the parallax speed factor.
| factor | New speed factor (0.5 = half speed) |
Definition at line 198 of file MapData.hpp.
References _parallaxSpeedFactor.
|
inline |
Set the scroll speed.
| speed | New scroll speed in pixels/second |
Definition at line 180 of file MapData.hpp.
References _scrollSpeed.
|
inline |
Set the spawn script.
| script | New Lua script path |
Definition at line 204 of file MapData.hpp.
References _spawnScript.
|
inline |
Update the elapsed time.
| deltaTime | Time increment in seconds |
Definition at line 222 of file MapData.hpp.
References _elapsedTime.
Referenced by ecs::MapSystem::update().
|
private |
Background asset path.
Definition at line 247 of file MapData.hpp.
Referenced by getBackgroundSprite(), and setBackgroundSprite().
|
private |
Map duration in seconds (0 = infinite)
Definition at line 252 of file MapData.hpp.
Referenced by getDuration(), and setDuration().
|
private |
Time spent on this map.
Definition at line 254 of file MapData.hpp.
Referenced by getElapsedTime(), reset(), and updateElapsedTime().
|
private |
Completion flag.
Definition at line 255 of file MapData.hpp.
Referenced by isCompleted(), markCompleted(), and reset().
|
private |
Unique map identifier.
Definition at line 244 of file MapData.hpp.
Referenced by getMapId(), and setMapId().
|
private |
|
private |
Next map to load after completion.
Definition at line 253 of file MapData.hpp.
Referenced by getNextMapId(), and setNextMapId().
|
private |
Parallax layer asset path (rendered on top, scrolls slower)
Definition at line 249 of file MapData.hpp.
Referenced by getParallaxBackgroundSprite(), and setParallaxBackgroundSprite().
|
private |
Speed factor for parallax layer (0.5 = half speed)
Definition at line 250 of file MapData.hpp.
Referenced by getParallaxSpeedFactor(), and setParallaxSpeedFactor().
|
private |
Horizontal scroll speed (px/s)
Definition at line 246 of file MapData.hpp.
Referenced by getScrollSpeed(), and setScrollSpeed().
|
private |
Lua script for spawn logic.
Definition at line 251 of file MapData.hpp.
Referenced by getSpawnScript(), and setSpawnScript().