17 static void update(void);
18 static void draw(void);
20 static void vblank(void);
23 static int nframes, num_vbl, backbuf;
24 static uint16_t *vram[] = { gba_vram_lfb0, gba_vram_lfb1 };
26 static const char *testlvl =
48 static struct xvertex tm_floor[] __attribute__((section(".rodata"))) = {
49 {0x10000, -0x10000, 0x10000, 0, 0x10000, 0, 210},
50 {-0x10000, -0x10000, 0x10000, 0, 0x10000, 0, 210},
51 {-0x10000, -0x10000, -0x10000, 0, 0x10000, 0, 210},
52 {0x10000, -0x10000, -0x10000, 0, 0x10000, 0, 210}
56 static struct level *lvl;
58 static struct player player;
67 gba_setmode(4, DISPCNT_BG2 | DISPCNT_OBJ | DISPCNT_FB1);
71 lvl = init_level(testlvl);
75 init_player(&player, lvl);
80 for(i=1; i<255; i++) {
86 select_input(BN_DPAD | BN_A | BN_B);
88 /* TODO emulate interrupts on non-GBA builds */
91 screen_vblank = vblank;
97 backbuf = ++nframes & 1;
98 fb = (unsigned char*)vram[backbuf];
100 polyfill_framebuffer(fb, 240, 160);
101 fillblock_16byte(fb, 0, 240 * 160 / 16);
113 static void update(void)
117 bnstate = get_input();
119 player_input(&player, bnstate);
121 upd_vis(lvl, &player);
124 static void draw(void)
130 /*xgl_translate(0, 0, 0x100000);*/
131 xgl_rotate_x(player.phi);
132 xgl_rotate_y(player.theta);
133 xgl_translate(player.x, 0, player.y);
135 for(i=0; i<lvl->numvis; i++) {
138 x = (int32_t)(cell->x - player.cx) << 17;
139 y = -(int32_t)(cell->y - player.cy) << 17;
142 xgl_translate(x, 0, y);
144 xgl_draw(XGL_QUADS, tm_floor, sizeof tm_floor / sizeof *tm_floor);
150 __attribute__((noinline, target("arm"), section(".iwram")))
151 static void vblank(void)