gba-x3dtest

view src/game.c @ 8:fb0a0d6a8b52

sortof works
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 19 Jun 2014 05:53:46 +0300
parents 73b5f2e5d18a
children b0ed38f13261
line source
1 #include "config.h"
2 #include "game.h"
3 #include "gbasys.h"
4 #include "x3d.h"
5 #include "sincos.h"
6 #include "fixed.h"
8 #define X16INT(x) ((x) << 16)
10 static const int32_t poly[] = {
11 X16INT(80), X16INT(10), 0,
12 X16INT(140), X16INT(100), 0,
13 X16INT(40), X16INT(80), 0
14 };
15 static const short vcount = sizeof poly / sizeof *poly / 3;
17 int game_init(void)
18 {
19 sincos_init();
21 return 0;
22 }
24 void game_draw(void)
25 {
26 unsigned long msec = get_millisec();
28 clear_buffer(back_buffer, 0);
30 x3d_load_identity();
31 x3d_translate(-itox16(WIDTH / 2), -itox16(HEIGHT / 2), 0);
32 x3d_rotate((msec / 64) << 16, 0, 0, 65536);
33 x3d_translate(itox16(WIDTH / 2), itox16(HEIGHT / 2), 0);
35 x3d_vertex_array(vcount, poly);
37 x3d_color(65536, 65536, 65536);
38 x3d_draw_arrays(X3D_TRIANGLES, vcount);
40 x3d_color(0, 65536, 0);
41 x3d_draw_arrays(X3D_POINTS, vcount);
43 x3d_vertex_array(0, 0);
45 flip();
46 }
48 void game_keyb(int key, int pressed)
49 {
50 }