gba-trycatch

annotate 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
rev   line source
nuclear@6 1 #include "config.h"
nuclear@5 2 #include "game.h"
nuclear@5 3 #include "gbasys.h"
nuclear@5 4 #include "polyfill.h"
nuclear@5 5
nuclear@5 6 #define X16INT(x) ((x) << 16)
nuclear@5 7
nuclear@5 8 static const pvec3 poly[] = {
nuclear@5 9 {X16INT(80), X16INT(10), 0},
nuclear@5 10 {X16INT(140), X16INT(100), 0},
nuclear@6 11 {X16INT(40), X16INT(80), 0}
nuclear@5 12 };
nuclear@5 13
nuclear@5 14 void game_draw(void)
nuclear@5 15 {
nuclear@6 16 int i;
nuclear@5 17 clear_buffer(back_buffer, 0);
nuclear@5 18
nuclear@5 19 draw_poly(3, poly, 0xffff);
nuclear@5 20
nuclear@6 21 for(i=0; i<sizeof poly / sizeof *poly; i++) {
nuclear@6 22 int x = poly[i].x >> 16;
nuclear@6 23 int y = poly[i].y >> 16;
nuclear@6 24
nuclear@6 25 ((uint16_t*)back_buffer->pixels)[y * WIDTH + x] = RGB(0, 255, 0);
nuclear@6 26 }
nuclear@6 27
nuclear@5 28 flip();
nuclear@5 29 }
nuclear@5 30
nuclear@5 31 void game_keyb(int key, int pressed)
nuclear@5 32 {
nuclear@5 33 }