From 86e5f5c71d4d74b2cf15c466d7d8e1eea40ae1fc Mon Sep 17 00:00:00 2001 From: auria Date: Mon, 3 Aug 2009 00:29:20 +0000 Subject: [PATCH] Configuring gamepad input works again git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3801 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/input/input_manager.cpp | 15 +++++++++------ src/input/input_manager.hpp | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/input/input_manager.cpp b/src/input/input_manager.cpp index 3c4826f88..74c533b08 100644 --- a/src/input/input_manager.cpp +++ b/src/input/input_manager.cpp @@ -165,9 +165,6 @@ void InputManager::handleStaticAction(int key, int value) } -// TODO: move as class member -std::map m_sensed_input_on_all_axes; - /** * Handles input when an input sensing mode (when configuring input) */ @@ -186,8 +183,13 @@ void InputManager::inputSensing(Input::InputType type, int deviceID, int btnID, if(m_mode == INPUT_SENSE_KEYBOARD && type != Input::IT_KEYBOARD) store_new = false; if(m_mode == INPUT_SENSE_GAMEPAD && type != Input::IT_STICKMOTION && type != Input::IT_STICKBUTTON) store_new = false; - // only store axes when they're pushed quite far - if(m_mode == INPUT_SENSE_GAMEPAD && type == Input::IT_STICKMOTION && abs(value) < Input::MAX_VALUE *2/3) store_new = false; + // only store axes and button presses when they're pushed quite far + if(m_mode == INPUT_SENSE_GAMEPAD && + (type == Input::IT_STICKMOTION || type == Input::IT_STICKBUTTON) && + abs(value) < Input::MAX_VALUE *2/3) + { + store_new = false; + } // for axis bindings, we request at least 2 different values bhefore accepting (ignore non-moving axes // as some devices have special axes that are at max value at rest) @@ -204,7 +206,8 @@ void InputManager::inputSensing(Input::InputType type, int deviceID, int btnID, } else if(type == Input::IT_STICKBUTTON) { - std::cout << "%% storing new gamepad button binding\n"; + std::cout << "%% storing new gamepad button binding value=" << value << + " deviceID=" << deviceID << " btnID=" << btnID << "\n"; } m_sensed_input->deviceID = deviceID; diff --git a/src/input/input_manager.hpp b/src/input/input_manager.hpp index 1970b9f74..98113f93a 100644 --- a/src/input/input_manager.hpp +++ b/src/input/input_manager.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "input/input.hpp" @@ -32,6 +33,7 @@ class DeviceManager; */ class InputManager { + std::map m_sensed_input_on_all_axes; public: enum InputDriverMode { MENU = 0,