2.15.1
Functions
Objects

ObjectList resources management. More...

Description

ObjectList resources management.

Functions

TLN_ObjectList TLN_CreateObjectList (void)
 Creates a TLN_ObjectList The list is created empty, it must be populated with TLN_AddSpriteToList() and assigned to a layer with TLN_SetLayerObjects() More...
 
bool TLN_AddTileObjectToList (TLN_ObjectList list, uint16_t id, uint16_t gid, uint16_t flags, int x, int y)
 Adds an image-based tileset item to given TLN_ObjectList. More...
 
TLN_ObjectList TLN_LoadObjectList (const char *filename, const char *layername)
 Loads an object list from a Tiled object layer. More...
 
TLN_ObjectList TLN_CloneObjectList (TLN_ObjectList src)
 Creates a duplicate of a given TLN_ObjectList object. More...
 
int TLN_GetListNumObjects (TLN_ObjectList list)
 Returns number of items in TLN_ObjectList. More...
 
bool TLN_GetListObject (TLN_ObjectList list, TLN_ObjectInfo *info)
 Iterates over elements in a TLN_ObjectList. More...
 
bool TLN_DeleteObjectList (TLN_ObjectList list)
 Deletes object list. More...
 

Function Documentation

◆ TLN_CreateObjectList()

TLN_ObjectList TLN_CreateObjectList ( void  )

Creates a TLN_ObjectList The list is created empty, it must be populated with TLN_AddSpriteToList() and assigned to a layer with TLN_SetLayerObjects()

Returns
Reference to new object or NULL if error

◆ TLN_AddTileObjectToList()

bool TLN_AddTileObjectToList ( TLN_ObjectList  list,
uint16_t  id,
uint16_t  gid,
uint16_t  flags,
int  x,
int  y 
)

Adds an image-based tileset item to given TLN_ObjectList.

Parameters
listReference to TLN_ObjectList
idUnique ID of the tileset object
gidGraphic Id (tile index) of the tileset object
flagsCombination of FLAG_FLIPX, FLAG_FLIPY, FLAG_PRIORITY
xLayer-space horizontal coordinate of the top-left corner
yLayer-space bertical coordinate of the top-left corner
Returns
true if success or false if error

◆ TLN_LoadObjectList()

TLN_ObjectList TLN_LoadObjectList ( const char *  filename,
const char *  layername 
)

Loads an object list from a Tiled object layer.

Parameters
filenameName of the .tmx file containing the list
layernameName of the layer to load
Returns
Reference to the loaded object or NULL if error

◆ TLN_CloneObjectList()

TLN_ObjectList TLN_CloneObjectList ( TLN_ObjectList  src)

Creates a duplicate of a given TLN_ObjectList object.

Parameters
srcReference to the source object to clone
Returns
A reference to the newly cloned object list, or NULL if error

◆ TLN_GetListNumObjects()

int TLN_GetListNumObjects ( TLN_ObjectList  list)

Returns number of items in TLN_ObjectList.

Parameters
listPointer to TLN_ObjectList to query
Returns
number of items

◆ TLN_GetListObject()

bool TLN_GetListObject ( TLN_ObjectList  list,
TLN_ObjectInfo info 
)

Iterates over elements in a TLN_ObjectList.

Parameters
listReference to TLN_ObjectList to get items
infoPointer to user-allocated TLN_ObjectInfo struct
Returns
true if item returned, false if no more items left
Remarks
The info pointer acts as a switch to select first/next element:
  • If not NULL, starts the iterator and returns the first item
  • If NULL, return the next item

◆ TLN_DeleteObjectList()

bool TLN_DeleteObjectList ( TLN_ObjectList  list)

Deletes object list.

Parameters
listReference to list to delete
Returns
true if success or false if error