gba-trycatch
diff src/game.c @ 12:ecc022a21279
more tuff
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 23 Jun 2014 06:44:04 +0300 |
parents | b0ed38f13261 |
children | 2070a81127f2 |
line diff
1.1 --- a/src/game.c Sun Jun 22 07:54:29 2014 +0300 1.2 +++ b/src/game.c Mon Jun 23 06:44:04 2014 +0300 1.3 @@ -9,11 +9,12 @@ 1.4 static void draw_rect(int x, int y, int w, int h, uint16_t color); 1.5 1.6 #define X16INT(x) ((x) << 16) 1.7 +#define X16FLT(x) ((int32_t)((x) * 65536.0)) 1.8 1.9 static const int32_t poly[] = { 1.10 - X16INT(120), X16INT(20), 0, 1.11 - X16INT(200), X16INT(130), 0, 1.12 - X16INT(40), X16INT(100), 0 1.13 + X16FLT(0), X16FLT(1), 0, 1.14 + X16FLT(1), X16FLT(-0.8), 0, 1.15 + X16FLT(-1), X16FLT(-0.5), 0 1.16 }; 1.17 static const short vcount = sizeof poly / sizeof *poly / 3; 1.18 1.19 @@ -24,6 +25,8 @@ 1.20 palman_init(); 1.21 #endif 1.22 1.23 + x3d_projection(45.0, (WIDTH << 16) / HEIGHT, 65536 / 2, 65536 * 500); 1.24 + 1.25 return 0; 1.26 } 1.27 1.28 @@ -37,13 +40,20 @@ 1.29 clear_buffer(back_buffer, 0); 1.30 1.31 x3d_load_identity(); 1.32 - x3d_translate(-itox16(WIDTH / 2), -itox16(HEIGHT / 2), 0); 1.33 + /*x3d_translate(-itox16(WIDTH / 2), -itox16(HEIGHT / 2), 0); 1.34 if(autorot) { 1.35 x3d_rotate((msec / 64) << 16, 0, 0, 65536); 1.36 } else { 1.37 x3d_rotate(keyrot << 16, 0, 0, 65536); 1.38 } 1.39 - x3d_translate(itox16(WIDTH / 2), itox16(HEIGHT / 2), 0); 1.40 + x3d_translate(itox16(WIDTH / 2), itox16(HEIGHT / 2), 0);*/ 1.41 + 1.42 + if(autorot) { 1.43 + x3d_rotate((msec / 64) << 16, 0, 65536, 0); 1.44 + } else { 1.45 + x3d_rotate(keyrot << 16, 0, 65536, 0); 1.46 + } 1.47 + x3d_translate(0, 0, X16INT(2)); 1.48 1.49 x3d_vertex_array(vcount, poly); 1.50 1.51 @@ -52,14 +62,14 @@ 1.52 #else 1.53 x3d_color(65536, 65536, 65536); 1.54 #endif 1.55 - x3d_draw_arrays(X3D_TRIANGLES, vcount); 1.56 + x3d_draw(X3D_TRIANGLES, vcount); 1.57 1.58 #ifdef PALMODE 1.59 x3d_color_index(RGBPAL(0, 255, 0)); 1.60 #else 1.61 x3d_color(0, 65536, 0); 1.62 #endif 1.63 - x3d_draw_arrays(X3D_POINTS, vcount); 1.64 + x3d_draw(X3D_POINTS, vcount); 1.65 x3d_vertex_array(0, 0); 1.66 1.67 draw_rect(0, 0, WIDTH, HEIGHT, RGBPAL(255, 0, 0));