R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
MapLoader.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** RTYPE
4** File description:
5** MapLoader.hpp - Utility for loading map configurations from JSON files
6*/
7
8#pragma once
9
10#include <fstream>
11#include <memory>
12#include <nlohmann/json.hpp>
13#include <optional>
14#include <string>
16
17namespace map {
18
36 class MapLoader {
37 public:
43 static std::optional<ecs::MapData> loadFromFile(const std::string &filePath);
44
50 static std::optional<ecs::MapData> loadFromString(const std::string &jsonString);
51
57 static std::optional<ecs::MapData> parseJson(const nlohmann::json &jsonObj);
58 };
59
60} // namespace map
Utility class for loading map configurations from JSON files.
Definition MapLoader.hpp:36
static std::optional< ecs::MapData > loadFromFile(const std::string &filePath)
Load a map from a JSON file.
Definition MapLoader.cpp:13
static std::optional< ecs::MapData > loadFromString(const std::string &jsonString)
Load a map from a JSON string.
Definition MapLoader.cpp:37
static std::optional< ecs::MapData > parseJson(const nlohmann::json &jsonObj)
Parse JSON object into MapData.
Definition MapLoader.cpp:51