Tilemap resources management for background layers. More...
Tilemap resources management for background layers.
Functions | |
TLN_Tilemap | TLN_CreateTilemap (int rows, int cols, TLN_Tile tiles, uint32_t bgcolor, TLN_Tileset tileset) |
Creates a new tilemap. More... | |
TLN_Tilemap | TLN_LoadTilemap (const char *filename, const char *layername) |
Loads a tilemap layer from a Tiled .tmx file. More... | |
TLN_Tilemap | TLN_CloneTilemap (TLN_Tilemap src) |
Creates a duplicate of the specified tilemap. More... | |
int | TLN_GetTilemapRows (TLN_Tilemap tilemap) |
Returns the number of vertical tiles in the tilemap. More... | |
int | TLN_GetTilemapCols (TLN_Tilemap tilemap) |
Returns the number of horizontal tiles in the tilemap. More... | |
bool | TLN_SetTilemapTileset (TLN_Tilemap tilemap, TLN_Tileset tileset) |
Sets default tileset to specified tilemap. More... | |
TLN_Tileset | TLN_GetTilemapTileset (TLN_Tilemap tilemap) |
Returns the optional associated tileset to the specified tilemap. More... | |
bool | TLN_SetTilemapTileset2 (TLN_Tilemap tilemap, TLN_Tileset tileset, int index) |
Sets default tileset to specified tilemap. More... | |
TLN_Tileset | TLN_GetTilemapTileset2 (TLN_Tilemap tilemap, int index) |
Returns the nth tileset associated tileset to the specified tilemap. More... | |
bool | TLN_GetTilemapTile (TLN_Tilemap tilemap, int row, int col, TLN_Tile tile) |
Gets data of a single tile inside a tilemap. More... | |
bool | TLN_SetTilemapTile (TLN_Tilemap tilemap, int row, int col, TLN_Tile tile) |
Sets a tile of a tilemap. More... | |
bool | TLN_CopyTiles (TLN_Tilemap src, int srcrow, int srccol, int rows, int cols, TLN_Tilemap dst, int dstrow, int dstcol) |
Copies blocks of tiles between two tilemaps. More... | |
TLN_Tile | TLN_GetTilemapTiles (TLN_Tilemap tilemap, int row, int col) |
Returns pointer to internal tilemap data data. More... | |
bool | TLN_DeleteTilemap (TLN_Tilemap tilemap) |
Deletes the specified tilemap and frees memory. More... | |
TLN_Tilemap TLN_CreateTilemap | ( | int | rows, |
int | cols, | ||
TLN_Tile | tiles, | ||
uint32_t | bgcolor, | ||
TLN_Tileset | tileset | ||
) |
Creates a new tilemap.
rows | Number of rows (vertical dimension) |
cols | Number of cols (horizontal dimension) |
tiles | Array of tiles with data (see struct Tile) |
bgcolor | Background color value (RGB32 packed) |
tileset | Optional reference to associated tileset, can be NULL |
TLN_Tilemap TLN_LoadTilemap | ( | const char * | filename, |
const char * | layername | ||
) |
Loads a tilemap layer from a Tiled .tmx file.
filename | TMX file with the tilemap |
layername | Optional name of the layer inside the tmx file to load. NULL to load the first layer |
TLN_Tilemap TLN_CloneTilemap | ( | TLN_Tilemap | src | ) |
Creates a duplicate of the specified tilemap.
src | Reference to the tilemap to clone |
int TLN_GetTilemapRows | ( | TLN_Tilemap | tilemap | ) |
Returns the number of vertical tiles in the tilemap.
tilemap | Reference of the tilemap to get info |
int TLN_GetTilemapCols | ( | TLN_Tilemap | tilemap | ) |
Returns the number of horizontal tiles in the tilemap.
tilemap | Reference of the tilemap to get info |
bool TLN_SetTilemapTileset | ( | TLN_Tilemap | tilemap, |
TLN_Tileset | tileset | ||
) |
Sets default tileset to specified tilemap.
tilemap | Reference to the tilemap to modify |
tileset | Reference to the tileset being assigned |
TLN_Tileset TLN_GetTilemapTileset | ( | TLN_Tilemap | tilemap | ) |
Returns the optional associated tileset to the specified tilemap.
tilemap | Reference of the tilemap to get info |
bool TLN_SetTilemapTileset2 | ( | TLN_Tilemap | tilemap, |
TLN_Tileset | tileset, | ||
int | index | ||
) |
Sets default tileset to specified tilemap.
tilemap | Reference to the tilemap to modify |
tileset | Reference to the tileset being assigned |
index | Index of tileset to set (0 - 7) |
TLN_Tileset TLN_GetTilemapTileset2 | ( | TLN_Tilemap | tilemap, |
int | index | ||
) |
Returns the nth tileset associated tileset to the specified tilemap.
tilemap | Reference of the tilemap to get info |
index | Tileset index (0 - 7) |
bool TLN_GetTilemapTile | ( | TLN_Tilemap | tilemap, |
int | row, | ||
int | col, | ||
TLN_Tile | tile | ||
) |
Gets data of a single tile inside a tilemap.
tilemap | Reference of the tilemap to get the tile |
row | Vertical location of the tile (0 <= row < rows) |
col | Horizontal location of the tile (0 <= col < cols) |
tile | Reference to an application-allocated struct Tile that will get the data |
bool TLN_SetTilemapTile | ( | TLN_Tilemap | tilemap, |
int | row, | ||
int | col, | ||
TLN_Tile | tile | ||
) |
Sets a tile of a tilemap.
tilemap | Reference to the tilemap |
row | Row (vertical position) of the tile [0 - num_rows - 1] |
col | Column (horizontal position) of the tile [0 - num_cols - 1] |
tile | Reference to the tile to set, or NULL to set an empty tile |
bool TLN_CopyTiles | ( | TLN_Tilemap | src, |
int | srcrow, | ||
int | srccol, | ||
int | rows, | ||
int | cols, | ||
TLN_Tilemap | dst, | ||
int | dstrow, | ||
int | dstcol | ||
) |
Copies blocks of tiles between two tilemaps.
src | Reference to the source tilemap |
srcrow | Starting row (vertical position) inside the source tilemap |
srccol | Starting column (horizontal position) inside the source tilemap |
rows | Number of rows to copy |
cols | Number of columns to copy |
dst | Reference to the target tilemap |
dstrow | Starting row (vertical position) inside the target tilemap |
dstcol | Starting column (horizontal position) inside the target tilemap |
TLN_Tile TLN_GetTilemapTiles | ( | TLN_Tilemap | tilemap, |
int | row, | ||
int | col | ||
) |
Returns pointer to internal tilemap data data.
tilemap | Tilemap being queried |
row | Row index |
col | Column index |
bool TLN_DeleteTilemap | ( | TLN_Tilemap | tilemap | ) |
Deletes the specified tilemap and frees memory.
tilemap | Reference to the tilemap to delete |
Last update on Tue Aug 29 2023 for Tilengine 2.15.1