![]() |
CRM64Pro GDK v0.15.0
A free cross-platform game development kit built on top of SDL 3.0
|
TileLayer class for tile-based map layers.
SceneLayerTile manages a 2D grid of tile indices (Global IDs) that reference tiles from loaded TileSets. Supports variable cell sizes and provides methods for tile manipulation and rendering.
Classes | |
| class | CRM64Pro::SceneLayerTile |
| TileLayer class for tile-based map layers. More... | |
Functions | |
| CRM64Pro::SceneLayerTile::SceneLayerTile (const string &sName, Sint32 height, Sint32 width) | |
| Constructor. | |
| eSceneLayerType | CRM64Pro::SceneLayerTile::getType () const override |
| Get the layer type. | |
| Sint32 | CRM64Pro::SceneLayerTile::getCellWidth () const |
| Get cell width. | |
| Sint32 | CRM64Pro::SceneLayerTile::getCellHeight () const |
| Get cell height. | |
| Sint32 | CRM64Pro::SceneLayerTile::getWidth () const |
| Get map width. | |
| Sint32 | CRM64Pro::SceneLayerTile::getHeight () const |
| Get map height. | |
| float | CRM64Pro::SceneLayerTile::getTotalWidth () const override |
| Get layer total width in pixels. | |
| float | CRM64Pro::SceneLayerTile::getTotalHeight () const override |
| Get layer total height in pixels. | |
| bool | CRM64Pro::SceneLayerTile::setCellWidth (Sint32 size) |
| Set cell width. | |
| bool | CRM64Pro::SceneLayerTile::setCellHeight (Sint32 size) |
| Set tile height. | |
| bool | CRM64Pro::SceneLayerTile::allocateCells (Sint32 height, Sint32 width, Uint32 value=0) |
| Allocate the 2D array for the cells. | |
| bool | CRM64Pro::SceneLayerTile::freeCells () |
| Free the 2D array of cells. | |
| bool | CRM64Pro::SceneLayerTile::setCellValue (Sint32 y, Sint32 x, Uint32 value) |
| Set arbitrary values on 2D array of cells. | |
| bool | CRM64Pro::SceneLayerTile::clone (SceneLayerTile *dest) |
| Copy the current values of the 2D array iCellMap to the given TileLayer. | |
| bool | CRM64Pro::SceneLayerTile::isValid () |
| Map validation. | |
| Sint32 | CRM64Pro::SceneLayerTile::info (Sint8 iTilesetReady, eLogLevel eLL) |
| Request TileLayer object information. | |
| VisibleRange | CRM64Pro::SceneLayerTile::calculateVisibleRange (const SDL_Rect &viewport, float fOffsetX, float fOffsetY) |
| Calculate visible range of tiles for a given viewport and offset. | |
| Sint32 | CRM64Pro::SceneLayerTile::update (Scene *pEngine, SceneLayerContext &context) override |
| Update tile layer logic. | |
| Sint32 | CRM64Pro::SceneLayerTile::render (Scene *pEngine, SceneLayerContext &context) override |
| Render tile layer content. | |
| Sint32 | CRM64Pro::SceneLayerTile::cellRender (Sint32 x_cell, Sint32 y_cell, float x_dst, float y_dst, Sint32 iAlpha, Sint32 idTileset, Uint32 idTile, Sint32 idRes) |
| Render a cell. | |
| Sint32 | CRM64Pro::Scene::createTileSet (Sint32 idRes, Sint32 globalID=-1) |
| Create a TileSet from a memory resource (Image or Tile). | |
| Sint32 | CRM64Pro::Scene::createTileSet (const string &sCDCFile, const string &sResourceName, Sint32 globalID=-1) |
| Create a TileSet from a CDC archive resource. | |
| Sint32 | CRM64Pro::Scene::createTileSetFromFile (const string &sPath, Sint32 globalID=-1, Sint32 iTileWidth=-1, Sint32 iTileHeight=-1) |
| Create a TileSet from a file on disk. | |
| bool | CRM64Pro::Scene::closeTileSet (Sint32 iTN) |
| Close and destroy a given TileSet. | |
| Sint32 | CRM64Pro::Scene::getTileResourceID (Sint32 iTN) |
| Resolve a Global Tile ID to its internal CRM64Pro Tile Resource ID. | |
| eSceneTileSetType | CRM64Pro::Scene::getTileSetType (Sint32 iTN) |
| Get the TileSet type. | |
| bool | CRM64Pro::Scene::getTileSetSource (Sint32 iTN, eSceneStorageMode &eMode, string &sPath, string &sFilename) |
| Get the storage metadata for a TileSet. | |
| bool | CRM64Pro::Scene::setTileSetSource (Sint32 iTN, eSceneStorageMode eMode, const string &sPath, const string &sFilename) |
| Set the storage metadata for a TileSet. | |
| CRM64Pro::SceneLayerTile::SceneLayerTile | ( | const string & | sName, |
| Sint32 | height, | ||
| Sint32 | width ) |
Constructor.
| sName | Layer name. |
| height | Map height (in cells). |
| width | Map width (in cells). |
|
overridevirtual |
| Sint32 CRM64Pro::SceneLayerTile::getCellWidth | ( | ) | const |
Get cell width.
| Sint32 CRM64Pro::SceneLayerTile::getCellHeight | ( | ) | const |
Get cell height.
| Sint32 CRM64Pro::SceneLayerTile::getWidth | ( | ) | const |
Get map width.
| Sint32 CRM64Pro::SceneLayerTile::getHeight | ( | ) | const |
Get map height.
|
overridevirtual |
Get layer total width in pixels.
Reimplemented from CRM64Pro::SceneLayer.
|
overridevirtual |
Get layer total height in pixels.
Reimplemented from CRM64Pro::SceneLayer.
| bool CRM64Pro::SceneLayerTile::setCellWidth | ( | Sint32 | size | ) |
Set cell width.
| size | integer with cell width (in pixels). |
| bool CRM64Pro::SceneLayerTile::setCellHeight | ( | Sint32 | size | ) |
Set tile height.
| size | integer with cell height (in pixels). |
| bool CRM64Pro::SceneLayerTile::allocateCells | ( | Sint32 | height, |
| Sint32 | width, | ||
| Uint32 | value = 0 ) |
Allocate the 2D array for the cells.
Each element on this 2D array is a cell.
| height | Selected height of your map. |
| width | Selected width of your map. |
| value | Default value to be assigned on each cell. |
| bool CRM64Pro::SceneLayerTile::freeCells | ( | ) |
Free the 2D array of cells.
| bool CRM64Pro::SceneLayerTile::setCellValue | ( | Sint32 | y, |
| Sint32 | x, | ||
| Uint32 | value ) |
Set arbitrary values on 2D array of cells.
It is mainly used for creating maps in a manual way.
| y | Selected Y position. Use -1 to affect all rows (Y axis). |
| x | Selected X position. Use -1 to affect all columns (X axis). |
| value | The value to be set on the given position. |
| bool CRM64Pro::SceneLayerTile::clone | ( | SceneLayerTile * | dest | ) |
Copy the current values of the 2D array iCellMap to the given TileLayer.
The destination must have identical attributes (width and height). If the destination has not an iCellMap, we will create one identical to the source
| dest | Pointer to destination SceneLayerTile or derivated object. |
| bool CRM64Pro::SceneLayerTile::isValid | ( | ) |
Map validation.
Validates iCellMap 2D array: checks tile layer width/height, and checks cell width/height.
| Sint32 CRM64Pro::SceneLayerTile::info | ( | Sint8 | iTilesetReady, |
| eLogLevel | eLL ) |
Request TileLayer object information.
Writes information to the default log.
| iTilesetReady | -1 do not display anything, 0 it is not ready and 1 it is ready. |
| eLL | importance of the message. Check ::eLogLevel enum for further information. |
| SceneLayerTile::VisibleRange CRM64Pro::SceneLayerTile::calculateVisibleRange | ( | const SDL_Rect & | viewport, |
| float | fOffsetX, | ||
| float | fOffsetY ) |
Calculate visible range of tiles for a given viewport and offset.
| viewport | Viewport rectangle. |
| fOffsetX | Layer X offset. |
| fOffsetY | Layer Y offset. |
|
overrideprotectedvirtual |
Update tile layer logic.
| pEngine | Pointer to the Scene instance. |
| context | Layer context structure containing update state. |
Implements CRM64Pro::SceneLayer.
|
overrideprotectedvirtual |
Render tile layer content.
| pEngine | Pointer to the Scene instance. |
| context | Layer context structure containing render state. |
Implements CRM64Pro::SceneLayer.
| Sint32 CRM64Pro::SceneLayerTile::cellRender | ( | Sint32 | x_cell, |
| Sint32 | y_cell, | ||
| float | x_dst, | ||
| float | y_dst, | ||
| Sint32 | iAlpha, | ||
| Sint32 | idTileset, | ||
| Uint32 | idTile, | ||
| Sint32 | idRes ) |
Render a cell.
| x_cell | Cell X coordinate to be rendered. |
| y_cell | Cell y coordinate to be rendered. |
| x_dst | Destination surface X coordinate to start to render in case you wish to. |
| y_dst | Destination surface Y coordinate to start to render in case you wish to. |
| iAlpha | Alpha modulation for this layer. This value overwrites the own tileset alpha modulation. |
| idTileset | tileset id. |
| idTile | which tile inside the tileset must be rendered. |
| idRes | a valid screen or image handle used as rendering target. |
| Sint32 CRM64Pro::Scene::createTileSet | ( | Sint32 | idRes, |
| Sint32 | globalID = -1 ) |
| Sint32 CRM64Pro::Scene::createTileSet | ( | const string & | sCDCFile, |
| const string & | sResourceName, | ||
| Sint32 | globalID = -1 ) |
Create a TileSet from a CDC archive resource.
| sCDCFile | Path to the CDC archive. |
| sResourceName | Name of the resource inside the CDC. |
| globalID | Initial Global ID for this TileSet. Use -1 to auto-assign the first available ID. |
| Sint32 CRM64Pro::Scene::createTileSetFromFile | ( | const string & | sPath, |
| Sint32 | globalID = -1, | ||
| Sint32 | iTileWidth = -1, | ||
| Sint32 | iTileHeight = -1 ) |
Create a TileSet from a file on disk.
| sPath | Path to the image file. |
| globalID | Initial Global ID for this TileSet. Use -1 to auto-assign the first available ID. |
| iTileWidth | Optional tile width override. |
| iTileHeight | Optional tile height override. |
| bool CRM64Pro::Scene::closeTileSet | ( | Sint32 | iTN | ) |
Close and destroy a given TileSet.
The affected layers (the ones that use any tile of this TileSet) will be disabled.
| iTN | Global ID or any tile of the TileSet to be removed. |
| Sint32 CRM64Pro::Scene::getTileResourceID | ( | Sint32 | iTN | ) |
Resolve a Global Tile ID to its internal CRM64Pro Tile Resource ID.
Retrieves the internal resource handle (ID) for the tile associated with the given Global ID. This ID can be used with ITileMgr() to modify tile attributes (animations, collision, etc.) directly.
| iTN | Global Tile ID (from the map data). |
| eSceneTileSetType CRM64Pro::Scene::getTileSetType | ( | Sint32 | iTN | ) |
Get the TileSet type.
| iTN | Global ID or any tile of the TileSet. |
| bool CRM64Pro::Scene::getTileSetSource | ( | Sint32 | iTN, |
| eSceneStorageMode & | eMode, | ||
| string & | sPath, | ||
| string & | sFilename ) |
Get the storage metadata for a TileSet.
| iTN | Global ID of the TileSet. |
| eMode | Output storage mode (Disk, CDC, or Internal). |
| sPath | Output path or CDC archive name. |
| sFilename | Output TSX or image filename. |
| bool CRM64Pro::Scene::setTileSetSource | ( | Sint32 | iTN, |
| eSceneStorageMode | eMode, | ||
| const string & | sPath, | ||
| const string & | sFilename ) |
Set the storage metadata for a TileSet.
Used to specify how the TileSet should be referenced when saving the level.
| iTN | Global ID of the TileSet. |
| eMode | Storage mode (Disk, CDC, or Internal). |
| sPath | Path or CDC archive name. |
| sFilename | TSX or image filename. |