Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
TilesetParser.h
Go to the documentation of this file.
1/*
2 * TilesetParser.h - Parser for external Tiled tileset files
3 *
4 * Supports parsing:
5 * - .tsx files (XML format) using tinyxml2
6 * - .tsj files (JSON format) using nlohmann::json
7 *
8 * Handles both image-based tilesets (single image grid) and
9 * collection tilesets (individual tile images).
10 */
11
12#pragma once
13
14#include "TiledStructures.h"
15#include "../../third_party/nlohmann/json.hpp"
16#include <string>
17#include <memory>
18
19namespace Olympe {
20namespace Tiled {
21
23 {
24 public:
27
28 // Parse external tileset file (auto-detects format by extension)
29 bool ParseFile(const std::string& filepath, TiledTileset& tileset);
30
31 // Parse TSX (XML) format
32 bool ParseTSX(const std::string& filepath, TiledTileset& tileset);
33
34 // Parse TSJ (JSON) format
35 bool ParseTSJ(const std::string& filepath, TiledTileset& tileset);
36
37 private:
38 void ParsePropertiesFromXML(void* element, std::map<std::string, TiledProperty>& properties);
39 void ParsePropertiesFromJSON(const nlohmann::json& j, std::map<std::string, TiledProperty>& properties);
42 };
43
44} // namespace Tiled
45} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
void ParsePropertiesFromJSON(const nlohmann::json &j, std::map< std::string, TiledProperty > &properties)
void ParseTileFromJSON(const nlohmann::json &j, TiledTile &tile)
void ParseTileFromXML(void *element, TiledTile &tile)
bool ParseTSJ(const std::string &filepath, TiledTileset &tileset)
bool ParseTSX(const std::string &filepath, TiledTileset &tileset)
void ParsePropertiesFromXML(void *element, std::map< std::string, TiledProperty > &properties)
bool ParseFile(const std::string &filepath, TiledTileset &tileset)
nlohmann::json json