Uranus  1.0.1.0
Uranus is a GameEngine written in C++
Loading...
Searching...
No Matches
tson::World Class Reference
Collaboration diagram for tson::World:
[legend]

Public Member Functions

 World (const fs::path &path, std::unique_ptr< tson::IJson > jsonParser=std::make_unique< tson::Json11 >())
 
 World (std::unique_ptr< tson::IJson > jsonParser=std::make_unique< tson::Json11 >())
 
bool contains (std::string_view filename)
 
const WorldMapDataget (std::string_view filename) const
 
const fs::path & getFolder () const
 
const std::vector< WorldMapData > & getMapData () const
 
const std::vector< std::unique_ptr< tson::Map > > & getMaps () const
 
const fs::path & getPath () const
 
const std::string & getType () const
 
std::size_t loadMaps (tson::Tileson *parser)
 
bool onlyShowAdjacentMaps () const
 
bool parse (const fs::path &path)
 

Private Member Functions

void parseJson (IJson &json)
 

Private Attributes

fs::path m_folder
 
std::unique_ptr< IJsonm_json = nullptr
 
std::vector< WorldMapDatam_mapData
 
std::vector< std::unique_ptr< tson::Map > > m_maps
 
bool m_onlyShowAdjacentMaps
 
fs::path m_path
 
std::string m_type
 

Member Function Documentation

◆ contains()

bool tson::World::contains ( std::string_view  filename)
inline

Check if there is WorldMapData in the world that contains the current filename. Filename = <file>.<extension>

Parameters
filename
Returns

◆ get()

const WorldMapData * tson::World::get ( std::string_view  filename) const
inline

Get a map by its filename

Parameters
filenameFilename (including extension) - (example: file.json)
Returns
pointer to WorldMapData or nullptr if not exists

◆ getMaps()

const std::vector< std::unique_ptr< tson::Map > > & tson::World::getMaps ( ) const
inline

Get all maps that have been loaded by loadMaps(). NOTE: This is untested, and was a last second addition to Tileson 1.2.0, as I had forgot about the loadMaps() functionality (also untested) If you find anything malfunctioning - please report.

Returns
All maps loaded by loadMaps()

◆ loadMaps()

std::size_t tson::World::loadMaps ( tson::Tileson parser)
inline

Loads the actual maps based on the world data.

Parameters
parserA Tileson object used for parsing the maps of the world.
Returns
How many maps who were parsed. Remember to call getStatus() for the actual map to find out if everything went okay.

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