![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Manages tilesets loaded from Tiled maps. More...
#include <World.h>
Classes | |
| struct | TilesetInfo |
| Information about a loaded tileset. More... | |
Public Member Functions | |
| void | Clear () |
| Clear all loaded tilesets. | |
| void | LoadTilesets (const nlohmann::json &tilesetsJson) |
| Load tilesets from JSON data. | |
| bool | GetTileTexture (uint32_t gid, SDL_Texture *&outTexture, SDL_Rect &outSrcRect, const TilesetInfo *&outTileset) |
| Get texture and source rect for a tile by GID. | |
| const std::vector< TilesetInfo > & | GetTilesets () const |
| Get all loaded tilesets. | |
Private Attributes | |
| std::vector< TilesetInfo > | m_tilesets |
| All loaded tilesets. | |
Manages tilesets loaded from Tiled maps.
Handles both image-based tilesets (single texture atlas) and collection tilesets (individual tile images).
Provides tile lookup by Global ID (GID) and texture access.
| void TilesetManager::Clear | ( | ) |
Clear all loaded tilesets.
Definition at line 1780 of file World.cpp.
References GetComponentTypeID_Static(), and m_tilesets.
Referenced by LoadTilesets(), and World::UnloadCurrentLevel().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Get all loaded tilesets.
Definition at line 172 of file World.h.
References m_tilesets.
| bool TilesetManager::GetTileTexture | ( | uint32_t | gid, |
| SDL_Texture *& | outTexture, | ||
| SDL_Rect & | outSrcRect, | ||
| const TilesetInfo *& | outTileset | ||
| ) |
Get texture and source rect for a tile by GID.
| gid | Global tile ID |
| outTexture | Output texture pointer |
| outSrcRect | Output source rectangle |
| outTileset | Output tileset info pointer |
Definition at line 2149 of file World.cpp.
References TilesetManager::TilesetInfo::columns, TilesetManager::TilesetInfo::firstgid, GetComponentTypeID_Static(), TilesetManager::TilesetInfo::individualSrcRects, TilesetManager::TilesetInfo::individualTiles, TilesetManager::TilesetInfo::isCollection, m_tilesets, TilesetManager::TilesetInfo::margin, TilesetManager::TilesetInfo::name, TilesetManager::TilesetInfo::spacing, SYSTEM_LOG, TilesetManager::TilesetInfo::texture, TilesetManager::TilesetInfo::tileheight, and TilesetManager::TilesetInfo::tilewidth.
Here is the call graph for this function:| void TilesetManager::LoadTilesets | ( | const nlohmann::json & | tilesetsJson | ) |
Load tilesets from JSON data.
| tilesetsJson | JSON array of tileset definitions |
Definition at line 1805 of file World.cpp.
References Clear(), DataManager::FindResourceRecursive(), TilesetManager::TilesetInfo::firstgid, DataManager::Get(), GetComponentTypeID_Static(), Olympe::Tiled::TilesetCache::GetInstance(), Olympe::Tiled::TilesetCache::GetTileset(), m_tilesets, GameEngine::renderer, SYSTEM_LOG, and TilesetManager::TilesetInfo::tileoffsetX.
Referenced by World::InstantiatePass1_VisualLayers().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
All loaded tilesets.
Definition at line 175 of file World.h.
Referenced by Clear(), GetTilesets(), GetTileTexture(), and LoadTilesets().