gba-trycatch

annotate 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
rev   line source
nuclear@6 1 #include "config.h"
nuclear@5 2 #include "game.h"
nuclear@5 3 #include "gbasys.h"
nuclear@8 4 #include "x3d.h"
nuclear@8 5 #include "sincos.h"
nuclear@8 6 #include "fixed.h"
nuclear@5 7
nuclear@5 8 #define X16INT(x) ((x) << 16)
nuclear@5 9
nuclear@8 10 static const int32_t poly[] = {
nuclear@8 11 X16INT(80), X16INT(10), 0,
nuclear@8 12 X16INT(140), X16INT(100), 0,
nuclear@8 13 X16INT(40), X16INT(80), 0
nuclear@5 14 };
nuclear@8 15 static const short vcount = sizeof poly / sizeof *poly / 3;
nuclear@8 16
nuclear@8 17 int game_init(void)
nuclear@8 18 {
nuclear@8 19 sincos_init();
nuclear@8 20
nuclear@8 21 return 0;
nuclear@8 22 }
nuclear@5 23
nuclear@5 24 void game_draw(void)
nuclear@5 25 {
nuclear@8 26 unsigned long msec = get_millisec();
nuclear@8 27
nuclear@5 28 clear_buffer(back_buffer, 0);
nuclear@5 29
nuclear@8 30 x3d_load_identity();
nuclear@8 31 x3d_translate(-itox16(WIDTH / 2), -itox16(HEIGHT / 2), 0);
nuclear@8 32 x3d_rotate((msec / 64) << 16, 0, 0, 65536);
nuclear@8 33 x3d_translate(itox16(WIDTH / 2), itox16(HEIGHT / 2), 0);
nuclear@5 34
nuclear@8 35 x3d_vertex_array(vcount, poly);
nuclear@6 36
nuclear@8 37 x3d_color(65536, 65536, 65536);
nuclear@8 38 x3d_draw_arrays(X3D_TRIANGLES, vcount);
nuclear@8 39
nuclear@8 40 x3d_color(0, 65536, 0);
nuclear@8 41 x3d_draw_arrays(X3D_POINTS, vcount);
nuclear@8 42
nuclear@8 43 x3d_vertex_array(0, 0);
nuclear@6 44
nuclear@5 45 flip();
nuclear@5 46 }
nuclear@5 47
nuclear@5 48 void game_keyb(int key, int pressed)
nuclear@5 49 {
nuclear@5 50 }