gba-x3dtest

diff src/main_sdl.c @ 18:f907b2c50a8b

added fps bar
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 26 Jun 2014 21:48:09 +0300
parents 2070a81127f2
children
line diff
     1.1 --- a/src/main_sdl.c	Thu Jun 26 06:57:51 2014 +0300
     1.2 +++ b/src/main_sdl.c	Thu Jun 26 21:48:09 2014 +0300
     1.3 @@ -104,7 +104,6 @@
     1.4  		if(SDL_MUSTLOCK(surf)) {
     1.5  			SDL_UnlockSurface(surf);
     1.6  		}
     1.7 -		keystate = 0;
     1.8  	}
     1.9  
    1.10  done:
    1.11 @@ -160,7 +159,7 @@
    1.12  	switch(ev->type) {
    1.13  	case SDL_KEYDOWN:
    1.14  	case SDL_KEYUP:
    1.15 -		handle_keyboard(ev->key.keysym.sym, ev->key.state);
    1.16 +		handle_keyboard(ev->key.keysym.sym, ev->key.state == SDL_PRESSED ? 1 : 0);
    1.17  		break;
    1.18  
    1.19  	case SDL_QUIT:
    1.20 @@ -233,6 +232,14 @@
    1.21  		return;
    1.22  	}
    1.23  
    1.24 -	keystate |= gba_key;
    1.25 +	if(gba_key == -1) {
    1.26 +		return;
    1.27 +	}
    1.28 +
    1.29 +	if(state) {
    1.30 +		keystate |= gba_key;
    1.31 +	} else {
    1.32 +		keystate &= ~gba_key;
    1.33 +	}
    1.34  	game_keyb(gba_key, state);
    1.35  }