fixed glitch in input config + cleaned up a bit the code
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3560 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4972f247be
commit
99ab952a5f
@ -259,6 +259,8 @@ namespace StateManager
|
||||
devices->addItem(name,internal_name,"gui/gamepad.png");
|
||||
}
|
||||
|
||||
getCurrentScreen()->m_inited = true;
|
||||
|
||||
}
|
||||
devices->updateItemDisplay();
|
||||
|
||||
@ -350,7 +352,7 @@ namespace StateManager
|
||||
getCurrentScreen()->showModalDialog();
|
||||
//INPUT_SENSE_PREFER_AXIS,
|
||||
//INPUT_SENSE_PREFER_BUTTON,
|
||||
input_manager->setMode(InputManager::INPUT_SENSE_PREFER_BUTTON);
|
||||
input_manager->setMode(InputManager::INPUT_SENSE_KEYBOARD);
|
||||
std::cout << "in sensing mode\n";
|
||||
}
|
||||
}
|
||||
|
@ -378,8 +378,8 @@ namespace StateManager
|
||||
|
||||
void escapePressed()
|
||||
{
|
||||
if(input_manager->isInMode(InputManager::INPUT_SENSE_PREFER_AXIS) ||
|
||||
input_manager->isInMode(InputManager::INPUT_SENSE_PREFER_BUTTON) )
|
||||
if(input_manager->isInMode(InputManager::INPUT_SENSE_KEYBOARD) ||
|
||||
input_manager->isInMode(InputManager::INPUT_SENSE_GAMEPAD) )
|
||||
{
|
||||
getCurrentScreen()->dismissModalDialog();
|
||||
input_manager->setMode(InputManager::MENU);
|
||||
|
@ -208,8 +208,8 @@ void InputManager::input(Input::InputType type, int deviceID, int btnID, int axi
|
||||
}
|
||||
|
||||
// Act different in input sensing mode.
|
||||
if (m_mode >= INPUT_SENSE_PREFER_AXIS &&
|
||||
m_mode <= INPUT_SENSE_PREFER_BUTTON)
|
||||
if (m_mode == INPUT_SENSE_KEYBOARD ||
|
||||
m_mode == INPUT_SENSE_GAMEPAD)
|
||||
{
|
||||
// Input sensing should be canceled. (TODO)
|
||||
//if (ga == GA_LEAVE && m_sensed_input->type==Input::IT_KEYBOARD)
|
||||
@ -228,13 +228,12 @@ void InputManager::input(Input::InputType type, int deviceID, int btnID, int axi
|
||||
// The latter is necessary since some gamepads have analog
|
||||
// buttons that can return two different events when pressed
|
||||
bool store_new = abs(value) > m_max_sensed_input ||
|
||||
m_max_sensed_type == Input::IT_NONE ||
|
||||
( m_mode == INPUT_SENSE_PREFER_AXIS &&
|
||||
type == Input::IT_STICKMOTION &&
|
||||
m_max_sensed_type != Input::IT_STICKMOTION ) ||
|
||||
( m_mode == INPUT_SENSE_PREFER_BUTTON &&
|
||||
type == Input::IT_STICKBUTTON &&
|
||||
m_max_sensed_type != Input::IT_STICKBUTTON );
|
||||
m_max_sensed_type == Input::IT_NONE ||
|
||||
( m_mode == INPUT_SENSE_GAMEPAD && type == Input::IT_STICKMOTION &&
|
||||
m_max_sensed_type != Input::IT_STICKMOTION ); /*||
|
||||
( m_mode == INPUT_SENSE_PREFER_BUTTON &&
|
||||
type == Input::IT_STICKBUTTON &&
|
||||
m_max_sensed_type != Input::IT_STICKBUTTON );*/
|
||||
if(store_new)
|
||||
{
|
||||
m_sensed_input->type = type;
|
||||
@ -417,8 +416,8 @@ bool InputManager::input(const SEvent& event)
|
||||
*/
|
||||
Input &InputManager::getSensedInput()
|
||||
{
|
||||
assert (m_mode >= INPUT_SENSE_PREFER_AXIS &&
|
||||
m_mode <= INPUT_SENSE_PREFER_BUTTON );
|
||||
assert (m_mode == INPUT_SENSE_KEYBOARD ||
|
||||
m_mode == INPUT_SENSE_GAMEPAD );
|
||||
|
||||
// m_sensed_input should be available in input sense mode.
|
||||
assert (m_sensed_input);
|
||||
@ -484,8 +483,8 @@ void InputManager::setMode(InputDriverMode new_mode)
|
||||
m_mode = MENU;
|
||||
|
||||
break;
|
||||
case INPUT_SENSE_PREFER_AXIS:
|
||||
case INPUT_SENSE_PREFER_BUTTON:
|
||||
case INPUT_SENSE_KEYBOARD:
|
||||
case INPUT_SENSE_GAMEPAD:
|
||||
// Leaving input sense mode.
|
||||
|
||||
irr_driver->showPointer();
|
||||
@ -528,8 +527,8 @@ void InputManager::setMode(InputDriverMode new_mode)
|
||||
m_mode = INGAME;
|
||||
|
||||
break;
|
||||
case INPUT_SENSE_PREFER_AXIS:
|
||||
case INPUT_SENSE_PREFER_BUTTON:
|
||||
case INPUT_SENSE_KEYBOARD:
|
||||
case INPUT_SENSE_GAMEPAD:
|
||||
// We must be in menu mode now in order to switch.
|
||||
assert (m_mode == MENU);
|
||||
|
||||
|
@ -36,8 +36,10 @@ public:
|
||||
enum InputDriverMode {
|
||||
MENU = 0,
|
||||
INGAME,
|
||||
INPUT_SENSE_PREFER_AXIS,
|
||||
INPUT_SENSE_PREFER_BUTTON,
|
||||
INPUT_SENSE_KEYBOARD,
|
||||
INPUT_SENSE_GAMEPAD,
|
||||
//INPUT_SENSE_PREFER_AXIS,
|
||||
//INPUT_SENSE_PREFER_BUTTON,
|
||||
LOWLEVEL,
|
||||
BOOTSTRAP
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user