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
This commit is contained in:
parent
6f2eeae5a7
commit
86e5f5c71d
@ -165,9 +165,6 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
|
||||
}
|
||||
|
||||
// TODO: move as class member
|
||||
std::map<int, int> 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;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <irrlicht.h>
|
||||
#include <map>
|
||||
|
||||
#include "input/input.hpp"
|
||||
|
||||
@ -32,6 +33,7 @@ class DeviceManager;
|
||||
*/
|
||||
class InputManager
|
||||
{
|
||||
std::map<int, int> m_sensed_input_on_all_axes;
|
||||
public:
|
||||
enum InputDriverMode {
|
||||
MENU = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user