tangstad/helds
tangstad
/
helds
Archived
1
0
Fork 0

Added nice white background.

Added test of keypresses, moving car to different locations depending on keydirection.
This commit is contained in:
Truls Alexander Tangstad 2005-11-22 19:57:46 +00:00
parent 16dbb5a2ed
commit a179e39eaa
1 changed files with 25 additions and 6 deletions

View File

@ -53,19 +53,38 @@ int main(void)
REG_IME = 1;
// screen mode, background and objects to display
SetMode( MODE_4 | BG2_ON | OBJ_ON | OBJ_1D_MAP );
SetMode( MODE_4 | BG2_ON | OBJ_ON | OBJ_1D_MAP );
u32 white = 0x10101010; CpuFastSet(&white, (void*)VRAM, FILL | 240*160/4);
FadeToPalette((void*)car_pal_bin, 1);
CpuFastSet(car_bin, BITMAP_OBJ_BASE_ADR, COPY32 | car_bin_size/4);
CpuFastSet(car_pal_bin, OBJ_COLORS, COPY32 | car_pal_bin_size/4);
CpuFastSet(car_pal_bin, OBJ_COLORS, COPY32 | car_pal_bin_size/4);
memset(&car, 0, sizeof(car));
car.attr2 = OBJ_CHAR(512);
car.attr1 = OBJ_SIZE(1) | OBJ_X(175);
car.attr1 = OBJ_SIZE(1) | OBJ_X(100);
car.attr0 = OBJ_256_COLOR | OBJ_Y(49);
VBlankIntrWait();
CpuFastSet(&car, OAM, COPY32 | sizeof(car)/4);
while (1) {}
while (1) {
if (KeysHeld() & KEY_RIGHT)
car.attr1 = OBJ_SIZE(1) | OBJ_X(172);
else if (KeysHeld() & KEY_LEFT)
car.attr1 = OBJ_SIZE(1) | OBJ_X(52);
else
car.attr1 = OBJ_SIZE(1) | OBJ_X(112);
if (KeysHeld() & KEY_UP)
car.attr0 = OBJ_256_COLOR | OBJ_Y(32);
else if (KeysHeld() & KEY_DOWN)
car.attr0 = OBJ_256_COLOR | OBJ_Y(112);
else
car.attr0 = OBJ_256_COLOR | OBJ_Y(72);
VBlankIntrWait();
CpuFastSet(&car, OAM, COPY32 | sizeof(car)/4);
}
}