start of movement and map
This commit is contained in:
parent
3b95d24e5e
commit
5a35105640
39
src/main.c
39
src/main.c
@ -1,7 +1,21 @@
|
|||||||
#include <genesis.h>
|
#include <genesis.h>
|
||||||
|
|
||||||
|
#define SPEED 2
|
||||||
|
|
||||||
Line l;
|
Line l;
|
||||||
|
|
||||||
|
const u8[][] = [[1,1,1,1,1,1,1,1,1,1],
|
||||||
|
[1,0,0,0,0,0,0,0,0,1],
|
||||||
|
[1,1,1,1,0,0,1,1,1,1],
|
||||||
|
[1,0,0,1,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,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,1,0,0,1],
|
||||||
|
[1,1,1,1,1,1,1,1,1,1]];
|
||||||
|
|
||||||
|
|
||||||
void render(){
|
void render(){
|
||||||
//Clear the bitmap
|
//Clear the bitmap
|
||||||
BMP_clear();
|
BMP_clear();
|
||||||
@ -21,18 +35,38 @@ void render(){
|
|||||||
l.pt2.y = 0;
|
l.pt2.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYS_doVBlankProcess();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(){
|
void update(){
|
||||||
|
u16 joy = JOY_readJoypad(JOY_1);
|
||||||
|
if(joy & BUTTON_LEFT) {
|
||||||
|
l.pt1.x -= SPEED;
|
||||||
|
}
|
||||||
|
if(joy & BUTTON_RIGHT) {
|
||||||
|
l.pt1.x += SPEED;
|
||||||
|
}
|
||||||
|
if(joy & BUTTON_UP) {
|
||||||
|
l.pt1.y -= SPEED;
|
||||||
|
}
|
||||||
|
if(joy & BUTTON_DOWN) {
|
||||||
|
l.pt1.y += SPEED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void initVDP(){
|
||||||
|
SYS_disableInts();
|
||||||
|
VDP_setPlaneSize(64,32,TRUE);
|
||||||
|
SYS_enableInts();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
initVDP();
|
||||||
|
|
||||||
//Initialise the bitmap engine
|
//Initialise the bitmap engine
|
||||||
BMP_init(TRUE, BG_A, PAL0, FALSE);
|
BMP_init(FALSE, BG_A, PAL0, FALSE);
|
||||||
|
|
||||||
//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);
|
||||||
@ -52,6 +86,7 @@ int main()
|
|||||||
while(TRUE)
|
while(TRUE)
|
||||||
{
|
{
|
||||||
render();
|
render();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user