intravenous

diff src/game.cc @ 4:c6a6a64df6de

normalmap
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 22 Apr 2012 05:20:03 +0300
parents 94d4c60af435
children aab0d8ea21cd
line diff
     1.1 --- a/src/game.cc	Sun Apr 22 03:35:18 2012 +0300
     1.2 +++ b/src/game.cc	Sun Apr 22 05:20:03 2012 +0300
     1.3 @@ -11,6 +11,7 @@
     1.4  
     1.5  static int keystate[256];
     1.6  static int dbg_inside = false;
     1.7 +static bool ignore_next_motion;
     1.8  
     1.9  static OrbitCamera dbgcam;
    1.10  
    1.11 @@ -113,6 +114,9 @@
    1.12  			if(dbg_inside) {
    1.13  				glutPassiveMotionFunc(game_input_mmotion);
    1.14  				glutSetCursor(GLUT_CURSOR_NONE);
    1.15 +
    1.16 +				ignore_next_motion = true;
    1.17 +				glutWarpPointer(win_xsz / 2, win_ysz / 2);
    1.18  			} else {
    1.19  				glutPassiveMotionFunc(0);
    1.20  				glutSetCursor(GLUT_CURSOR_INHERIT);
    1.21 @@ -143,21 +147,20 @@
    1.22  
    1.23  void game_input_mmotion(int x, int y)
    1.24  {
    1.25 -	static bool ignore_next;
    1.26  	int dx = x - prev_x;
    1.27  	int dy = y - prev_y;
    1.28  	prev_x = x;
    1.29  	prev_y = y;
    1.30  
    1.31 -	if(ignore_next) {
    1.32 -		ignore_next = false;
    1.33 +	if(ignore_next_motion) {
    1.34 +		ignore_next_motion = false;
    1.35  		return;
    1.36  	}
    1.37  
    1.38  	if(dbg_inside) {
    1.39  		ship.turn((float)-dx / win_xsz, (float)-dy / win_ysz);
    1.40  
    1.41 -		ignore_next = true;
    1.42 +		ignore_next_motion = true;
    1.43  		glutWarpPointer(win_xsz / 2, win_ysz / 2);
    1.44  	} else {
    1.45  		if(bnstate[0]) {