gba-x3dtest

diff src/game.c @ 19:62390f9cc93e

texture cache optimization failed
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 30 Jun 2014 09:07:41 +0300
parents f907b2c50a8b
children
line diff
     1.1 --- a/src/game.c	Thu Jun 26 21:48:09 2014 +0300
     1.2 +++ b/src/game.c	Mon Jun 30 09:07:41 2014 +0300
     1.3 @@ -23,6 +23,7 @@
     1.4  static struct mesh box;
     1.5  static int tex;
     1.6  static int fps;
     1.7 +static short show_fps = 1;
     1.8  
     1.9  int game_init(void)
    1.10  {
    1.11 @@ -95,7 +96,9 @@
    1.12  	draw_mesh(&box);
    1.13  	x3d_disable_texture();
    1.14  
    1.15 -	draw_fps_meter(msec);
    1.16 +	if(show_fps) {
    1.17 +		draw_fps_meter(msec);
    1.18 +	}
    1.19  
    1.20  	flip();
    1.21  }
    1.22 @@ -109,7 +112,7 @@
    1.23  
    1.24  	++nframes;
    1.25  
    1.26 -	if(dt >= 1000) {
    1.27 +	if(dt >= 1500) {
    1.28  		last_msec = msec;
    1.29  		fps = 1000 * nframes / dt;
    1.30  		nframes = 0;
    1.31 @@ -119,7 +122,7 @@
    1.32  	bar_height = fps * 4;
    1.33  	if(bar_height > HEIGHT) bar_height = HEIGHT;
    1.34  
    1.35 -	draw_rect(0, HEIGHT - bar_height, 1, bar_height, RGB(0, 255, 0));
    1.36 +	draw_rect(0, HEIGHT - bar_height - 1, 1, bar_height, RGB(0, 255, 0));
    1.37  }
    1.38  
    1.39  void game_keyb(int key, int pressed)
    1.40 @@ -135,6 +138,10 @@
    1.41  		dbg_fill_dump = 1;
    1.42  		break;
    1.43  
    1.44 +	case KEY_START:
    1.45 +		show_fps = !show_fps;
    1.46 +		break;
    1.47 +
    1.48  	default:
    1.49  		break;
    1.50  	}