gba-trycatch

diff 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 diff
     1.1 --- a/src/game.c	Mon Jun 16 22:01:45 2014 +0300
     1.2 +++ b/src/game.c	Wed Jun 18 04:13:02 2014 +0300
     1.3 @@ -1,3 +1,4 @@
     1.4 +#include "config.h"
     1.5  #include "game.h"
     1.6  #include "gbasys.h"
     1.7  #include "polyfill.h"
     1.8 @@ -7,15 +8,23 @@
     1.9  static const pvec3 poly[] = {
    1.10  	{X16INT(80), X16INT(10), 0},
    1.11  	{X16INT(140), X16INT(100), 0},
    1.12 -	{X16INT(40), X16INT(800), 0}
    1.13 +	{X16INT(40), X16INT(80), 0}
    1.14  };
    1.15  
    1.16  void game_draw(void)
    1.17  {
    1.18 +	int i;
    1.19  	clear_buffer(back_buffer, 0);
    1.20  
    1.21  	draw_poly(3, poly, 0xffff);
    1.22  
    1.23 +	for(i=0; i<sizeof poly / sizeof *poly; i++) {
    1.24 +		int x = poly[i].x >> 16;
    1.25 +		int y = poly[i].y >> 16;
    1.26 +
    1.27 +		((uint16_t*)back_buffer->pixels)[y * WIDTH + x] = RGB(0, 255, 0);
    1.28 +	}
    1.29 +
    1.30  	flip();
    1.31  }
    1.32