Issue 275: Fixed cursor 'moving by itself' by disabling joystick control on desktop platforms
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1251 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									75226f6438
								
							
						
					
					
						commit
						3294a304bf
					
				
							
								
								
									
										15
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								Makefile
									
									
									
									
									
								
							@ -251,6 +251,7 @@ else
 | 
			
		||||
        NOTTF = 1
 | 
			
		||||
        PLATFORM = gp2x
 | 
			
		||||
        STRIP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-strip
 | 
			
		||||
        JOYCOPT = -DUSE_JOYSTICK
 | 
			
		||||
      else
 | 
			
		||||
 | 
			
		||||
        # Compiles a regular linux exectutable for the native platform
 | 
			
		||||
@ -302,13 +303,13 @@ else
 | 
			
		||||
	LUALABEL =
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
#To disable Joystick emulation of cursor, make NOJOY=1 (for input.o)
 | 
			
		||||
#This can be necessary to test keyboard cursor code, because an existing
 | 
			
		||||
#joystick will keep reporting a contradicting position.
 | 
			
		||||
ifeq ($(NOJOY),1)
 | 
			
		||||
  JOYCOPT = -DNO_JOYCURSOR
 | 
			
		||||
else
 | 
			
		||||
  JOYCOPT =
 | 
			
		||||
#To enable Joystick emulation of cursor, make USE_JOYSTICK=1 (for input.o)
 | 
			
		||||
#This can be necessary to test cursor code on a PC, but by default for all
 | 
			
		||||
#non-console platforms the joystick is disabled, to avoid reporting
 | 
			
		||||
#'restless' movements when an analog joystick or a poorly-calibrated joypad
 | 
			
		||||
#is plugged in.
 | 
			
		||||
ifeq ($(USE_JOYSTICK),1)
 | 
			
		||||
  JOYCOPT = -DUSE_JOYSTICK
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
#To speed up rendering, can disable the layered editing
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								input.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								input.c
									
									
									
									
									
								
							@ -465,7 +465,6 @@ int Handle_joystick_press(SDL_JoyButtonEvent event)
 | 
			
		||||
    #ifdef __GP2X__
 | 
			
		||||
    switch(event.button)
 | 
			
		||||
    {
 | 
			
		||||
      #ifndef NO_JOYCURSOR
 | 
			
		||||
      case GP2X_BUTTON_UP:
 | 
			
		||||
        Directional_up=1;
 | 
			
		||||
        break;
 | 
			
		||||
@ -490,7 +489,6 @@ int Handle_joystick_press(SDL_JoyButtonEvent event)
 | 
			
		||||
      case GP2X_BUTTON_UPLEFT:
 | 
			
		||||
        Directional_up_left=1;
 | 
			
		||||
        break;
 | 
			
		||||
      #endif
 | 
			
		||||
      default:
 | 
			
		||||
		break;
 | 
			
		||||
    }
 | 
			
		||||
@ -563,7 +561,6 @@ int Handle_joystick_release(SDL_JoyButtonEvent event)
 | 
			
		||||
 | 
			
		||||
void Handle_joystick_movement(SDL_JoyAxisEvent event)
 | 
			
		||||
{
 | 
			
		||||
    #ifndef NO_JOYCURSOR
 | 
			
		||||
    if (event.axis==0) // X
 | 
			
		||||
    {
 | 
			
		||||
      Directional_right=Directional_left=0;
 | 
			
		||||
@ -584,7 +581,6 @@ void Handle_joystick_movement(SDL_JoyAxisEvent event)
 | 
			
		||||
      else if (event.value>1000)
 | 
			
		||||
        Directional_down=1;
 | 
			
		||||
    }
 | 
			
		||||
    #endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attempts to move the mouse cursor by the given deltas (may be more than 1 pixel at a time)
 | 
			
		||||
@ -674,6 +670,9 @@ int Get_input(void)
 | 
			
		||||
                Handle_key_release(event.key);
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
            // Start of Joystik handling
 | 
			
		||||
            #ifdef USE_JOYSTICK
 | 
			
		||||
 | 
			
		||||
            case SDL_JOYBUTTONUP:
 | 
			
		||||
                Handle_joystick_release(event.jbutton);
 | 
			
		||||
                user_feedback_required = 1;
 | 
			
		||||
@ -688,6 +687,9 @@ int Get_input(void)
 | 
			
		||||
                Handle_joystick_movement(event.jaxis);
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
            #endif
 | 
			
		||||
            // End of Joystick handling
 | 
			
		||||
            
 | 
			
		||||
            default:
 | 
			
		||||
            //    DEBUG("Unhandled SDL event number : ",event.type);
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user