TileMap
Inherited: None
Description
TileMap is a fundamental resource class used to define a grid of tiles for creating the layout of a game or application. It represents a grid-based map where each cell can be assigned a specific tile ID.
Public Methods
int |
cellHeight () const |
int |
cellWidth () const |
int |
height () const |
bool |
hexOdd () const |
int |
hexSideLength () const |
int |
orientation () const |
void |
refreshAllTiles () const |
void |
setCellHeight (int height) |
void |
setCellWidth (int width) |
void |
setHeight (int height) |
void |
setHexOdd (bool odd) |
void |
setHexSideLength (int length) |
void |
setOrientation (int orientation) |
void |
setTile (int x, int y, int id) |
void |
setTileSet (TileSet * set) |
void |
setWidth (int width) |
int |
tile (int x, int y) const |
Mesh * |
tileMesh () const |
TileSet * |
tileSet () const |
int |
width () const |
Static Methods
None
Methods Description
int TileMap::cellHeight () const
Returns the height of a single grid cell in pixels.
See also setCellHeight().
int TileMap::cellWidth () const
Returns the width of a single grid cell in pixels.
See also setCellWidth().
int TileMap::height () const
Returns the height of the tile map in terms of grid cells.
See also setHeight().
bool TileMap::hexOdd () const
Returns true if the stagger index for hexagonal tiles is set to odd, false otherwise.
See also setHexOdd().
int TileMap::hexSideLength () const
Returns the side length of hexagonal tiles in pixels.
See also setHexSideLength().
int TileMap::orientation () const
Returns the orientation of the tile map. This can be one of the constants defined in the TileSet class, such as TileSet::Orthogonal, TileSet::Isometric, or TileSet::Hexagonal.
See also setOrientation().
void TileMap::refreshAllTiles () const
Refreshes all the tiles in the tile map, updating the tile mesh with the latest tile information based on the tile set and map data.
void TileMap::setCellHeight (int height)
Sets the height of a single grid cell in pixels.
See also cellHeight().
void TileMap::setCellWidth (int width)
Sets the width of a single grid cell in pixels.
See also cellWidth().
void TileMap::setHeight (int height)
Sets the height of the tile map in grid cells. It resizes the map data accordingly.
See also *height*().
void TileMap::setHexOdd (bool odd)
Sets the stagger index for hexagonal tiles. If odd is true, it sets the stagger index to 1; otherwise, it sets it to 0.
See also hexOdd().
void TileMap::setHexSideLength (int length)
Sets the side length of hexagonal tiles in pixels.
See also hexSideLength().
void TileMap::setOrientation (int orientation)
Sets the orientation of the tile map. This affects how the tiles are positioned within the map.
See also *orientation*().
void TileMap::setTile (int x, int y, int id)
Sets the tile id at the specified grid cell coordinates (x, y).
See also tile().
void TileMap::setTileSet (TileSet * set)
Sets the associated tile set for this tile map.
See also tileSet().
void TileMap::setWidth (int width)
Sets the width of the tile map in grid cells. It resizes the map data accordingly.
See also *width*().
int TileMap::tile (int x, int y) const
Returns the tile ID at the specified grid cell coordinates (x, y).
See also setTile().
Mesh * TileMap::tileMesh () const
Returns a pointer to a mesh representing the tile map’s geometry. This mesh is updated and regenerated as needed.
TileSet * TileMap::tileSet () const
Returns a pointer to the associated TileSet that defines the available tiles for this tile map.
See also setTileSet().
int TileMap::width () const
Returns the width of the tile map in terms of grid cells.
See also setWidth().