.. _api_TileMap: TileMap ======= Inherited: :ref:`Resource` .. _api_TileMap_description: 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. .. _api_TileMap_public: Public Methods -------------- +--------------------------------+----------------------------------------------------------------+ | int | :ref:`cellHeight` () const | +--------------------------------+----------------------------------------------------------------+ | int | :ref:`cellWidth` () const | +--------------------------------+----------------------------------------------------------------+ | int | :ref:`height` () const | +--------------------------------+----------------------------------------------------------------+ | bool | :ref:`hexOdd` () const | +--------------------------------+----------------------------------------------------------------+ | int | :ref:`hexSideLength` () const | +--------------------------------+----------------------------------------------------------------+ | int | :ref:`orientation` () const | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`refreshAllTiles` () const | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setCellHeight` (int height) | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setCellWidth` (int width) | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setHeight` (int height) | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setHexOdd` (bool odd) | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setHexSideLength` (int length) | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setOrientation` (int orientation) | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setTile` (int x, int y, int id) | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setTileSet` (TileSet * set) | +--------------------------------+----------------------------------------------------------------+ | void | :ref:`setWidth` (int width) | +--------------------------------+----------------------------------------------------------------+ | int | :ref:`tile` (int x, int y) const | +--------------------------------+----------------------------------------------------------------+ | :ref:`Mesh` * | :ref:`tileMesh` () const | +--------------------------------+----------------------------------------------------------------+ | :ref:`TileSet` * | :ref:`tileSet` () const | +--------------------------------+----------------------------------------------------------------+ | int | :ref:`width` () const | +--------------------------------+----------------------------------------------------------------+ .. _api_TileMap_static: Static Methods -------------- None .. _api_TileMap_methods: Methods Description ------------------- .. _api_TileMap_e9d3468c: int **TileMap::cellHeight** () const Returns the height of a single grid cell in pixels. **See also** setCellHeight(). ---- .. _api_TileMap_1aeb6fd0: int **TileMap::cellWidth** () const Returns the width of a single grid cell in pixels. **See also** setCellWidth(). ---- .. _api_TileMap_032487ad: int **TileMap::height** () const Returns the height of the tile map in terms of grid cells. **See also** setHeight(). ---- .. _api_TileMap_f0b8e24c: bool **TileMap::hexOdd** () const Returns true if the stagger index for hexagonal tiles is set to odd, false otherwise. **See also** setHexOdd(). ---- .. _api_TileMap_3c6d0954: int **TileMap::hexSideLength** () const Returns the side length of hexagonal tiles in pixels. **See also** setHexSideLength(). ---- .. _api_TileMap_6495c8df: 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(). ---- .. _api_TileMap_ebf8957c: 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. ---- .. _api_TileMap_bc7618de: void **TileMap::setCellHeight** (int *height*) Sets the *height* of a single grid cell in pixels. **See also** cellHeight(). ---- .. _api_TileMap_9641efc2: void **TileMap::setCellWidth** (int *width*) Sets the *width* of a single grid cell in pixels. **See also** cellWidth(). ---- .. _api_TileMap_9f401c86: void **TileMap::setHeight** (int *height*) Sets the *height* of the tile map in grid cells. It resizes the map data accordingly. **See also** height(). ---- .. _api_TileMap_d8f915ea: 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(). ---- .. _api_TileMap_d68f53a0: void **TileMap::setHexSideLength** (int *length*) Sets the side *length* of hexagonal tiles in pixels. **See also** hexSideLength(). ---- .. _api_TileMap_27c40afe: 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(). ---- .. _api_TileMap_b231d578: void **TileMap::setTile** (int *x*, int *y*, int *id*) Sets the tile *id* at the specified grid cell coordinates (x, y). **See also** tile(). ---- .. _api_TileMap_2f594d87: void **TileMap::setTileSet** (:ref:`TileSet` * *set*) Sets the associated tile *set* for this tile map. **See also** tileSet(). ---- .. _api_TileMap_f84acdb2: void **TileMap::setWidth** (int *width*) Sets the *width* of the tile map in grid cells. It resizes the map data accordingly. **See also** width(). ---- .. _api_TileMap_26a910cb: int **TileMap::tile** (int *x*, int *y*) const Returns the tile ID at the specified grid cell coordinates (x, y). **See also** setTile(). ---- .. _api_TileMap_2c1e5b40: :ref:`Mesh` * **TileMap::tileMesh** () const Returns a pointer to a mesh representing the tile map's geometry. This mesh is updated and regenerated as needed. ---- .. _api_TileMap_6e5412ba: :ref:`TileSet` * **TileMap::tileSet** () const Returns a pointer to the associated TileSet that defines the available tiles for this tile map. **See also** setTileSet(). ---- .. _api_TileMap_16fec0d9: int **TileMap::width** () const Returns the width of the tile map in terms of grid cells. **See also** setWidth().