| CRM64Pro GDK v0.18.0 A free cross-platform game development kit built on top of SDL 3.0

Loading...
Searching...
No Matches
CRM64Pro::SceneLayerTile
Scene modules » Scene Layer » Scene Layer Tile

TileLayer class for tile-based map layers. More...

## Detailed Description

TileLayer class for tile-based map layers.

Inheritance diagram for CRM64Pro::SceneLayerTile:

## Classes
struct | VisibleRange
| Visible Range structure. More...

## Public Member Functions
template<typename T>
T ** | create2DArray (Sint32 iHeight, Sint32 iWidth)
| Template: dynamic 2D array of a given data type.
template<typename T>
Sint32 | free2DArray (T **ppArray)
| Template: delete a dynamic 2D array.
Sint32 | getCellWidth () const
| Get cell width.
bool | setCellWidth (Sint32 iSize)
| Set cell width.
Sint32 | getCellHeight () const
| Get cell height.
bool | setCellHeight (Sint32 iSize)
| Set cell height.
Sint32 | getWidth () const
| Get map width.
Sint32 | getHeight () const
| Get map height.
bool | allocateCells (Sint32 iHeight, Sint32 iWidth, Uint32 iValue=0)
| Allocate the 2D array for the cells.
bool | freeCells ()
| Free the 2D array of cells.
bool | setCellValue (Sint32 iY, Sint32 iX, Uint32 iValue)
| Set arbitrary values on 2D array of cells.
bool | clone (SceneLayerTile *pDest)
| Copy the current values of the 2D array iCellMap to the given TileLayer.
bool | isValid () const
| Map validation.
Sint32 | info (Sint8 iTilesetReady, eLogLevel eLL)
| Request TileLayer object information.
Sint32 | cellRender (Sint32 iCellX, Sint32 iCellY, float fDstX, float fDstY, Sint32 iAlpha, Sint32 idTileset, Uint32 idTile, Sint32 idRes)
| Render a cell.
eSceneLayerType | getType () const override
| Get the layer type.
VisibleRange | calculateVisibleRange (const SDL_Rect &rViewport, float fOffsetX, float fOffsetY)
| Calculate visible range of tiles for a given viewport and offset.
float | getTotalWidth () const override
| Get layer total width in pixels.
float | getTotalHeight () const override
| Get layer total height in pixels.
Public Member Functions inherited from CRM64Pro::SceneLayer
void | setOnUpdateCallback (SceneLayerCallback fnCallback)
| Set the callback for update events.
void | setOnRenderCallback (SceneLayerCallback fnCallback)
| Set the callback for render events.
SceneLayerCallback | getOnUpdateCallback () const
| Get the update callback.
SceneLayerCallback | getOnRenderCallback () const
| Get the render callback.

## Public Attributes
Uint32 ** | iCellMap
| Direct mutable 2D cell map.

## Protected Member Functions
Sint32 | update (Scene *pEngine, SceneLayerContext &rContext) override
| Update tile layer logic.
Sint32 | render (Scene *pEngine, SceneLayerContext &rContext) override
| Render tile layer content.

## Member Function Documentation

## ◆ create2DArray()

template<typename T>

T ** CRM64Pro::SceneLayerTile::create2DArray | ( | Sint32 | iHeight,
|  | Sint32 | iWidth )
| inline

Template: dynamic 2D array of a given data type.

Parameters

  iHeight | Selected height of your 2D array
  iWidth | Selected width of your 2D array

Returns
  A pointer to the dynamic 2D array.

## ◆ free2DArray()

template<typename T>

Sint32 CRM64Pro::SceneLayerTile::free2DArray | ( | T ** | ppArray | ) |
| inline

Template: delete a dynamic 2D array.

Parameters

  ppArray | pointer to 2D array.

Returns
  0 on success.

## Member Data Documentation

## ◆ iCellMap

Uint32** CRM64Pro::SceneLayerTile::iCellMap

Direct mutable 2D cell map.

Public access is provided for fast tile-layer editing and direct row/column traversal. The pointer is owned by SceneLayerTile and must not be freed, reallocated, or replaced by user code. Direct writes bypass setCellValue() validation, bounds checks, and future cache or validation hooks; use setCellValue() when validation is required. Valid indices are [0, getHeight() - 1] for rows and [0, getWidth() - 1] for columns when the map is allocated.