Input cleanup, only relays button events when the button state has actually changed. Won't issue multiple button events when the button

is only pressed once (doesn't unload arsenal when fire button is tapped, etc.).



git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3827 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
rforder 2009-08-09 18:47:01 +00:00
parent aee48faca8
commit abfda2b933

View File

@ -382,7 +382,8 @@ bool InputManager::input(const SEvent& event)
{
const bool isButtonPressed = event.JoystickEvent.IsButtonPressed(i);
if(gp->isButtonPressed(i) || isButtonPressed)
// Only report button events when the state of the button changes
if((!gp->isButtonPressed(i) && isButtonPressed) || (gp->isButtonPressed(i) && !isButtonPressed))
input(Input::IT_STICKBUTTON, event.JoystickEvent.Joystick, i, 0,
isButtonPressed ? Input::MAX_VALUE : 0, programaticallyGenerated);
gp->setButtonPressed(i, isButtonPressed);