Data Structures | |
struct | UL_MAP |
Map type. More... | |
Enumerations | |
enum | UL_MAP_FORMATS { UL_MF_U16 = 0, UL_MF_U16_GBA } |
Functions | |
UL_MAP * | ulCreateMap (UL_IMAGE *img, void *map_data, int tileX, int tileY, int mapSizeX, int mapSizeY, int map_format) |
void | ulDeleteMap (UL_MAP *map) |
void | ulDrawMap (UL_MAP *m) |
enum UL_MAP_FORMATS |
UL_MAP* ulCreateMap | ( | UL_IMAGE * | img, | |
void * | map_data, | |||
int | tileX, | |||
int | tileY, | |||
int | mapSizeX, | |||
int | mapSizeY, | |||
int | map_format | |||
) |
Creates a new map.
img | Source image, containing the tileset for the map. Tiles are placed from left to right, and from top to bottom by lines. A simple tileset containing 8 tiles of 16x16 each could be 128x16, 64x32, 16x128, etc. The width of the image MUST be a power of two and CANNOT exceed the maximum width of DS textures (2048?). If so, place some tiles on the next line. | |
map_data | Pointer to the raw map data. It's just a table whose size is mapSizeX * mapSizeY and currently each table entry is a 16 bits integer. | |
tileX,tileY | Size of a tile in the tileset. In the above example, it would be 16 and 16. Please note that they MUST be a power of two! | |
mapSizeX,mapSizeY | Dimensions of the map (x = width, y = height). | |
map_format | Currently supported map formats are:
|
Namely, GBA Graphics has an option to generate a map with the first tile being always transparent. Some other editors may do it as well, and in any way, the only thing you've got to care about is that the first tile in the tileset is transparent.
Note: The tileset's tint1 member is used to tint the ENTIRE map, no gradient is made!
void ulDeleteMap | ( | UL_MAP * | map | ) |
Deletes a map. Call this once you've finished with a map.
map | Map previously created with ulCreateMap. |
void ulDrawMap | ( | UL_MAP * | m | ) |
Draws a map on the screen.
Please note that drawing a map requires a large number of polygons (one for each tile) to be drawn on the screen, which will fill the vertex memory a lot. A single fullscreen 8x8 scrolled map (33x25) already requires 825 quads, which is about 55% the total available memory! To spare some memory, you should always use tiles that are at least 16x16 (15% memory this time) and use if possible null map entries (transparent), which are simply skipped.