|
R-Type
Distributed multiplayer game engine in C++
|
Utility class for loading map configurations from JSON files. More...
#include <MapLoader.hpp>

Static Public Member Functions | |
| static std::optional< ecs::MapData > | loadFromFile (const std::string &filePath) |
| Load a map from a JSON file. | |
| static std::optional< ecs::MapData > | loadFromString (const std::string &jsonString) |
| Load a map from a JSON string. | |
| static std::optional< ecs::MapData > | parseJson (const nlohmann::json &jsonObj) |
| Parse JSON object into MapData. | |
Utility class for loading map configurations from JSON files.
Parses JSON map configuration files and creates MapData components.
JSON format example: { "mapId": "level_1", "name": "Zone Alpha", "scrollSpeed": 50.0, "background": "backgrounds/space_1.png", "spawnScript": "maps/level_1_spawn.lua", "duration": 120.0, "nextMap": "level_2" }
Definition at line 36 of file MapLoader.hpp.
|
static |
Load a map from a JSON file.
| filePath | Path to the JSON file (relative or absolute) |
Definition at line 13 of file MapLoader.cpp.
References LOG_ERROR, LOG_INFO, and parseJson().
Referenced by server::GameLogic::loadMap().

|
static |
Load a map from a JSON string.
| jsonString | JSON configuration string |
Definition at line 37 of file MapLoader.cpp.
References LOG_ERROR, and parseJson().

|
static |
Parse JSON object into MapData.
| jsonObj | nlohmann::json object |
Definition at line 51 of file MapLoader.cpp.
References LOG_DEBUG, LOG_ERROR, and LOG_INFO.
Referenced by loadFromFile(), and loadFromString().