 |
Cytopia
0.3
A city building simulation game
|
Go to the documentation of this file. 1 #ifndef TILEMANAGER_HXX_
2 #define TILEMANAGER_HXX_
5 #include <unordered_map>
6 #include <unordered_set>
13 #include "../common/enums.hxx"
TileManager & operator=(TileManager const &)=delete
TileOrientation calculateTileOrientation(unsigned char bitMaskElevation)
Calculates the TileOrientation for elevated tiles to pick the correct Sprite.
std::vector< std::string > getAllTileIDsForZone(ZoneType zone, ZoneDensity zoneDensity, TileSize tileSize={1, 1})
Get the All Tile IDs for a zone with a certain tileSize.
std::vector< Point > getTargetCoordsOfTileID(const Point &targetCoordinates, const std::string &tileID)
Return a vector of Points on a target node (origin corner) that would be occupied by a given tileID i...
How many tiles are occupied by a building.
size_t calculateSlopeOrientation(unsigned char bitMaskElevation)
Calculates the slope orientation for elevated tiles to pick the correct slope Sprite.
This class holds all the information about tileIDs gathered from TileData.json.
std::optional< std::string > getRandomTileIDForZoneWithRandomSize(ZoneType zone, ZoneDensity zoneDensity, TileSize maxTileSize={1, 1})
Pick a single random tileID for a zone with a random tilesize within the supplied max Size.
std::unordered_map< std::string, TileData > m_tileData
Layer getTileLayer(const std::string &tileID) const
Get the Layer that is associated with a tileID. The Tile will be placed on this layer.
std::unordered_set< TileSize > m_tileSizeCombinations
const std::unordered_map< std::string, TileData > & getAllTileData() const
SDL_Texture * getTexture(const std::string &tileID) const
Get the Texture for the tileID.
void init()
Parse the tileData JSON and set up the tileManager.
TileData * getTileData(const std::string &id) noexcept
Get the TileData struct for this tileID and all information associated with it.
Abstract Singleton implementation.
bool isTileIDAutoTile(const std::string &tileID)
check if given TileID can autotile (meaning there are textures that look differently according to the...
void addJSONObjectToTileData(const nlohmann::json &tileDataJSON, size_t idx, const std::string &id)
@ TILE_DEFAULT_ORIENTATION
Holds all releavted information to this specific tile.