16 static void update(void);
17 static void draw(void);
18 static void vblank(void);
20 static int nframes, num_vbl, backbuf;
21 static uint16_t *vram[] = { (uint16_t*)VRAM_LFB_FB0_ADDR, (uint16_t*)VRAM_LFB_FB1_ADDR };
23 static const char *testlvl =
37 static struct xvertex tm_floor[] __attribute__((section(".rodata"))) = {
38 {0x10000, -0x10000, 0x10000, 0, 0x10000, 0, 210},
39 {-0x10000, -0x10000, 0x10000, 0, 0x10000, 0, 210},
40 {-0x10000, -0x10000, -0x10000, 0, 0x10000, 0, 210},
41 {0x10000, -0x10000, -0x10000, 0, 0x10000, 0, 210}
45 static struct level *lvl;
47 static struct player player;
54 REG_DISPCNT = 4 | DISPCNT_BG2 | DISPCNT_OBJ | DISPCNT_FB1;
56 vblperf_setcolor(0xff);
58 lvl = init_level(testlvl);
62 memset(&player, 0, sizeof player);
65 select_input(BN_DPAD | BN_A | BN_B);
68 screen_vblank = vblank;
73 backbuf = ++nframes & 1;
74 fb = (unsigned char*)vram[backbuf];
76 polyfill_framebuffer(fb, 240, 160);
77 fillblock_16byte(fb, 0, 240 * 160 / 16);
89 static void update(void)
93 bnstate = get_input();
95 player_input(&player, bnstate);
97 upd_vis(lvl, player.x, player.y, player.theta);
100 static void draw(void)
103 xgl_rotate_x(player.phi);
104 xgl_rotate_y(player.theta);
105 xgl_translate(player.x, 0, player.y);
107 xgl_draw(XGL_QUADS, tm_floor, sizeof tm_floor / sizeof *tm_floor);
110 __attribute__((noinline, target("arm"), section(".iwram")))
111 static void vblank(void)