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

Loading...
Searching...
No Matches
CRM64Pro::SceneLayerTile
Scene module » Scene Layer base » Scene LayerTile

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 height, Sint32 width)
| Template: dynamic 2D array of a given data type.
template<typename T>
Sint32 | free2DArray (T **Array)
| Template: delete a dynamic 2D array.
Sint32 | getCellWidth () const
| Get cell width.
bool | setCellWidth (Sint32 size)
| Set cell width.
Sint32 | getCellHeight () const
| Get cell height.
bool | setCellHeight (Sint32 size)
| Set tile height.
Sint32 | getWidth () const
| Get map width.
Sint32 | getHeight () const
| Get map height.
bool | allocateCells (Sint32 height, Sint32 width, Uint32 value=0)
| Allocate the 2D array for the cells.
bool | freeCells ()
| Free the 2D array of cells.
bool | setCellValue (Sint32 y, Sint32 x, Uint32 value)
| Set arbitrary values on 2D array of cells.
bool | clone (SceneLayerTile *dest)
| Copy the current values of the 2D array iCellMap to the given TileLayer.
bool | isValid ()
| Map validation.
Sint32 | info (Sint8 iTilesetReady, eLogLevel eLL)
| Request TileLayer object information.
Sint32 | cellRender (Sint32 x_cell, Sint32 y_cell, float x_dst, float y_dst, Sint32 iAlpha, Sint32 idTileset, Uint32 idTile, Sint32 idRes)
| Render a cell.
eSceneLayerType | getType () const override
| Get the layer type.
VisibleRange | calculateVisibleRange (const SDL_Rect &viewport, 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.
| SceneLayerTile (const string &sName, Sint32 height, Sint32 width)
| Constructor.
Public Member Functions inherited from CRM64Pro::SceneLayer
void | setOnUpdateCallback (SCENE_OnLayerCallback callback)
| Set the callback for update events.
void | setOnRenderCallback (SCENE_OnLayerCallback callback)
| Set the callback for render events.
SCENE_OnLayerCallback | getOnUpdateCallback () const
| Get the update callback.
SCENE_OnLayerCallback | getOnRenderCallback () const
| Get the render callback.

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

## Member Function Documentation

## ◆ create2DArray()

template<typename T>

T ** CRM64Pro::SceneLayerTile::create2DArray | ( | Sint32 | height,
|  | Sint32 | width )
| inline

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

Parameters

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

Returns
  A Pointer to the dynamic 2D array

## ◆ free2DArray()

template<typename T>

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

Template: delete a dynamic 2D array.

Parameters

  Array | pointer to 2D array.

Returns
  0 on success.