KKTilemapLayerTiles Class Reference
Inherits from | NSObject |
Declared in | KKTilemapLayerTiles.h |
Overview
TMX Tiles of a tile layer. This is just a list of GIDs pointing to a specific tile in the tileset. The GIDs have the KTTilemapTileFlip flags encoded, so it is recommended to use the tileAt method from KTTilemapLayer instead of accessing the GIDs directly.
However the latter may be preferable if you need to access many GIDs consecutively, for example for pathfinding algorithms. And if there are no flip flags used on the pathfinding layer, you don’t even need to mask out the KTTilemapTileFlip flags.
Properties
bytes
the size (in bytes) of the GID memory buffer. Equal to (mapSize.width * mapSize.height * sizeof(gid_t)).
@property (atomic, readonly) unsigned int bytes
Return Value
the size (in bytes) of the GID memory buffer. Equal to (mapSize.width * mapSize.height * sizeof(gid_t)).
Declared In
KKTilemapLayerTiles.h
Instance Methods
retainGidBuffer:sizeInBytes:
Takes an already allocated GID buffer with the given bufferSize (in bytes) and takes ownership for it. Which means: you should not free() the tiles buffer, it will be freed by KTTilemapLayerTiles when it deallocates.
- (void)retainGidBuffer:(gid_t *)gid sizeInBytes:(unsigned int)sizeInBytes
Parameters
- gid
A pointer to a member buffer containing tile GIDs.
- sizeInBytes
The size of the buffer in bytes.
Discussion
This method also sets the gidCount, which it derives from (gidSize / sizeof(gid_t)).
Declared In
KKTilemapLayerTiles.h