From abfda2b9333d40bb63fdb313817fa5dcf400e8a5 Mon Sep 17 00:00:00 2001 From: rforder Date: Sun, 9 Aug 2009 18:47:01 +0000 Subject: [PATCH] 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 --- src/input/input_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/input/input_manager.cpp b/src/input/input_manager.cpp index 1534b747a..f4d9c2a69 100644 --- a/src/input/input_manager.cpp +++ b/src/input/input_manager.cpp @@ -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);