map display
This commit is contained in:
parent
5a35105640
commit
945b68ce1c
42
src/main.c
42
src/main.c
@ -4,16 +4,34 @@
|
|||||||
|
|
||||||
Line l;
|
Line l;
|
||||||
|
|
||||||
const u8[][] = [[1,1,1,1,1,1,1,1,1,1],
|
const u8 map[10][10] = {{1,1,1,1,1,1,1,1,1,1},
|
||||||
[1,0,0,0,0,0,0,0,0,1],
|
{1,0,0,0,0,0,0,0,0,1},
|
||||||
[1,1,1,1,0,0,1,1,1,1],
|
{1,1,1,1,0,0,1,1,1,1},
|
||||||
[1,0,0,1,0,0,1,0,0,1],
|
{1,0,0,1,0,0,1,0,0,1},
|
||||||
[1,0,0,0,0,0,1,0,0,1],
|
{1,0,0,0,0,0,1,0,0,1},
|
||||||
[1,0,0,1,0,0,1,1,0,1],
|
{1,0,0,1,0,0,1,1,0,1},
|
||||||
[1,1,1,1,0,0,1,0,0,1],
|
{1,1,1,1,0,0,1,0,0,1},
|
||||||
[1,0,0,0,0,0,0,0,0,1],
|
{1,0,0,0,0,0,0,0,0,1},
|
||||||
[1,0,0,0,0,0,1,0,0,1],
|
{1,0,0,0,0,0,1,0,0,1},
|
||||||
[1,1,1,1,1,1,1,1,1,1]];
|
{1,1,1,1,1,1,1,1,1,1}};
|
||||||
|
|
||||||
|
void mapscan(){
|
||||||
|
|
||||||
|
u8 mapcolor = 14;
|
||||||
|
mapcolor |= mapcolor << 4;
|
||||||
|
int mapscale = 10;
|
||||||
|
|
||||||
|
for(u8 x = 0; x < 10; x++){
|
||||||
|
for(u8 y = 0; y < 10; y++){
|
||||||
|
if(map[y][x] == 1){
|
||||||
|
Vect2D_s16 mapverts[4] = {{x*mapscale,y*mapscale},{(x+1)*mapscale,y*mapscale},{(x+1)*mapscale,(y+1)*mapscale},{x*mapscale,(y+1)*mapscale}};
|
||||||
|
BMP_drawPolygon(mapverts, 4, mapcolor);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void render(){
|
void render(){
|
||||||
@ -23,6 +41,8 @@ void render(){
|
|||||||
//Draw the line defined above (in the background, hidden)
|
//Draw the line defined above (in the background, hidden)
|
||||||
BMP_drawLine(&l);
|
BMP_drawLine(&l);
|
||||||
|
|
||||||
|
mapscan();
|
||||||
|
|
||||||
//Flip the data to the screen - i.e. actually draw the complete image on screen
|
//Flip the data to the screen - i.e. actually draw the complete image on screen
|
||||||
BMP_flip(1);
|
BMP_flip(1);
|
||||||
|
|
||||||
@ -70,7 +90,7 @@ int main()
|
|||||||
|
|
||||||
//Set the colour of the line. We are using pallete 0 for the bitmap, so we have 0->15. 15 is used for white text, so we set an unused pallet colour, 14 to blue - RGB 0000FF.
|
//Set the colour of the line. We are using pallete 0 for the bitmap, so we have 0->15. 15 is used for white text, so we set an unused pallet colour, 14 to blue - RGB 0000FF.
|
||||||
u16 colour_blue = RGB24_TO_VDPCOLOR(0x0000ff);
|
u16 colour_blue = RGB24_TO_VDPCOLOR(0x0000ff);
|
||||||
u16 colour_red = RGB24_TO_VDPCOLOR(0xff0000);
|
u16 colour_red = RGB24_TO_VDPCOLOR(0x756a4a);
|
||||||
PAL_setColor(14, colour_blue);
|
PAL_setColor(14, colour_blue);
|
||||||
PAL_setColor(13, colour_red);
|
PAL_setColor(13, colour_red);
|
||||||
VDP_setBackgroundColor(13);
|
VDP_setBackgroundColor(13);
|
||||||
|
Loading…
Reference in New Issue
Block a user