Skip to content

TileMapGeneric

Struct

Source: Renderer.h

Description

Generic tilemap structure supporting 1bpp, 2bpp, or 4bpp tile graphics.

T The sprite type used for tiles (Sprite, Sprite2bpp, or Sprite4bpp).

Properties

NameTypeDescription
indicesuint8_t*Pointer to tile indices array (size = width * height).
widthuint8_tMap width in tiles.
heightuint8_tMap height in tiles.
TconstPointer to tileset array.
tileWidthuint8_tWidth of each tile in pixels.
tileHeightuint8_tHeight of each tile in pixels.
tileCountuint16_tNumber of unique tiles in the tileset.
runtimeMaskuint8_t*Bitmask for runtime tile activation (1 bit per tile, nullptr = all active)
animManagerTileAnimationManager*Optional animation manager for tile animations

Methods

inline void initRuntimeMask()

Description:

Initialize runtime mask buffer for tile activation control.

TIP

Must be called before using isTileActive() or setTileActive()

TIP

Existing mask is freed if already allocated

inline bool isTileActive(int x, int y) const

Description:

Check if a tile is currently active (visible).

Parameters:

  • x: Tile X coordinate
  • y: Tile Y coordinate

Returns: true if tile is active, false if inactive

TIP

Returns true for out-of-bounds coordinates or when no mask is initialized

inline void setTileActive(int x, int y, bool active)

Description:

Set tile activation state.

Parameters:

  • x: Tile X coordinate
  • y: Tile Y coordinate
  • active: true to activate tile (visible), false to deactivate (hidden)

TIP

Out-of-bounds coordinates are ignored

inline uint8_t* getRuntimeMask() const

Description:

Get pointer to runtime mask buffer.

Returns: Pointer to runtime mask array, or nullptr if not initialized

inline void cleanupRuntimeMask()

Description:

Destructor cleanup for runtime mask.

Released under the MIT License.