Function DrawMap: Difference between revisions

From Uzebox Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Function
{{Function
|prototype  = void DrawMap(unsigned char x,unsigned char y,const int *map); (V1-V3 kernel, deprecated in V4)
|prototype  = void DrawMap(unsigned char x,unsigned char y,const int *map); (V1-V3 kernel, deprecated in V4)<br>
void DrawMap(unsigned char x,unsigned char y, void *map); (V4 kernel)
void DrawMap(unsigned char x,unsigned char y, void *map); (V4 kernel)
|description = Draws a rectangular map pointed to by <code>*map</code> at the specified coordinates. Maps are int or char arrays (depending on the active video mode) in which the two first elements respectively specifies the width and height of the map. This function expects the data to be located in flash (PROGMEM).
|description = Draws a rectangular map pointed to by <code>*map</code> at the specified coordinates. Maps are int or char arrays (depending on the active video mode) in which the two first elements respectively specifies the width and height of the map. This function expects the data to be located in flash (PROGMEM).

Revision as of 22:44, 2 March 2009

Prototype

void DrawMap(unsigned char x,unsigned char y,const int *map); (V1-V3 kernel, deprecated in V4)
void DrawMap(unsigned char x,unsigned char y, void *map); (V4 kernel)

Description

Draws a rectangular map pointed to by *map at the specified coordinates. Maps are int or char arrays (depending on the active video mode) in which the two first elements respectively specifies the width and height of the map. This function expects the data to be located in flash (PROGMEM).

Parameters
  • x: Position from left of screen
  • y: Position from top of screen
  • map: Pointer to int/char array in PROGMEM.
Returns

Void

Video Modes

2,3

Since

V4

Example:

const char my_map[] PROGMEM ={2,3, 0x02,0xcc, 0x03,0x02, 0x23,0x54}; //you would usually put map data in import files
#include "data/my_tiles.inc";
int main(void){
  SetTileTable(my_tiles);
  ClearVram();
  DrawMap(10,10,my_map);
  while(1);
}