Data Structures | |
struct | OSL_MAP |
Typedefs | |
typedef enum OSL_MAP_FLAGS | OSL_MAP_FLAGS |
Enumerations | |
enum | OSL_MAP_FORMATS { OSL_MF_U16 =1, OSL_MF_U16_GBA =2 } |
enum | OSL_MAP_FLAGS { OSL_MF_SIMPLE =1, OSL_MF_TILE1_TRANSPARENT =2 } |
Functions | |
OSL_MAP * | oslCreateMap (OSL_IMAGE *img, void *map_data, int tileX, int tileY, int mapSizeX, int mapSizeY, int map_format) |
void | oslDrawMap (OSL_MAP *m) |
void | oslDrawMapSimple (OSL_MAP *m) |
void | oslDeleteMap (OSL_MAP *m) |
Map functions in OSLib.
typedef enum OSL_MAP_FLAGS OSL_MAP_FLAGS |
Internal map flags.
enum OSL_MAP_FORMATS |
enum OSL_MAP_FLAGS |
OSL_MAP* oslCreateMap | ( | OSL_IMAGE * | img, |
void * | map_data, | ||
int | tileX, | ||
int | tileY, | ||
int | mapSizeX, | ||
int | mapSizeY, | ||
int | map_format | ||
) |
Creates a new map.
img | Image used as tileset. Remember the maximum size of images is 512x512, neither the width or the height can exceed 512. In a tileset image, tiles are placed from in lines from left to right and from top to bottom. Each tile has a specific size. |
map_data | Binary data representing the map data in its raw format. This is a table of entries, where each entry is 16-bit (or something else depending on the map format) and represents a tile number to be displayed. Please note that tile entries, just like tilesets, are placed from left to right, and then from top to bottom. To retrieve a specific map entry (x = horizontal position, y = vertical position), the algorithm is the following: ((map_type*)map_data)[y * width + x]. |
tileX,tileY | Size of a tile in the tileset. |
mapSizeX,mapSizeY | Width and height of the map. Maps are wrapped around (that is, when you're all to the right, the left is displayed again, same vertically). |
map_format | One of the OSL_MAP_FORMATS values. |
void oslDrawMap | ( | OSL_MAP * | m | ) |
Draws a map on the screen, using the map properties:
void oslDrawMapSimple | ( | OSL_MAP * | m | ) |
Same as oslDrawMap, only here for backward compatibility. Do not use!
void oslDeleteMap | ( | OSL_MAP * | m | ) |
Deletes a map. Call this after you've finished with a map. Please note that the map data you supplied to oslCreateMap was your own data, passed by reference, and thus it will not be freed! Example: