gba-trycatch

view src/game.c @ 6:73b5f2e5d18a

first triangle on screen
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 18 Jun 2014 04:13:02 +0300
parents 850be43b3135
children fb0a0d6a8b52
line source
1 #include "config.h"
2 #include "game.h"
3 #include "gbasys.h"
4 #include "polyfill.h"
6 #define X16INT(x) ((x) << 16)
8 static const pvec3 poly[] = {
9 {X16INT(80), X16INT(10), 0},
10 {X16INT(140), X16INT(100), 0},
11 {X16INT(40), X16INT(80), 0}
12 };
14 void game_draw(void)
15 {
16 int i;
17 clear_buffer(back_buffer, 0);
19 draw_poly(3, poly, 0xffff);
21 for(i=0; i<sizeof poly / sizeof *poly; i++) {
22 int x = poly[i].x >> 16;
23 int y = poly[i].y >> 16;
25 ((uint16_t*)back_buffer->pixels)[y * WIDTH + x] = RGB(0, 255, 0);
26 }
28 flip();
29 }
31 void game_keyb(int key, int pressed)
32 {
33 }