Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
TilesetManager Class Reference

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< TilesetInfom_tilesets
 All loaded tilesets.
 

Detailed Description

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.

Examples
/home/runner/work/Olympe-Engine/Olympe-Engine/Source/World.h.

Definition at line 95 of file World.h.

Member Function Documentation

◆ Clear()

void TilesetManager::Clear ( )

Clear all loaded tilesets.

Examples
/home/runner/work/Olympe-Engine/Olympe-Engine/Source/World.h.

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:

◆ GetTilesets()

const std::vector< TilesetInfo > & TilesetManager::GetTilesets ( ) const
inline

Get all loaded tilesets.

Returns
Reference to tileset vector
Examples
/home/runner/work/Olympe-Engine/Olympe-Engine/Source/World.h.

Definition at line 172 of file World.h.

References m_tilesets.

◆ GetTileTexture()

bool TilesetManager::GetTileTexture ( uint32_t  gid,
SDL_Texture *&  outTexture,
SDL_Rect outSrcRect,
const TilesetInfo *&  outTileset 
)

◆ LoadTilesets()

void TilesetManager::LoadTilesets ( const nlohmann::json tilesetsJson)

Load tilesets from JSON data.

Parameters
tilesetsJsonJSON array of tileset definitions
Examples
/home/runner/work/Olympe-Engine/Olympe-Engine/Source/World.h.

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:

Member Data Documentation

◆ m_tilesets

std::vector<TilesetInfo> TilesetManager::m_tilesets
private

All loaded tilesets.

Examples
/home/runner/work/Olympe-Engine/Olympe-Engine/Source/World.h.

Definition at line 175 of file World.h.

Referenced by Clear(), GetTilesets(), GetTileTexture(), and LoadTilesets().


The documentation for this class was generated from the following files: