Fixed crash in game dialogs + Fixed input sensing issue

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4008 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-09-05 17:27:14 +00:00
parent 92ab67d95b
commit d891996797
3 changed files with 30 additions and 6 deletions

View File

@ -391,7 +391,18 @@ void EventHandler::navigateUp(const int playerID, Input::InputType type, const b
else
{
// select the last widget
Widget* w = GUIEngine::getCurrentScreen()->getLastWidget();
Widget* w = NULL;
if (ModalDialog::isADialogActive())
{
// TODO : select last widget in modal dialogs
}
else
{
Screen* screen = GUIEngine::getCurrentScreen();
if (screen == NULL) return;
w = screen->getLastWidget();
}
if (w != NULL)
{
@ -464,7 +475,19 @@ void EventHandler::navigateDown(const int playerID, Input::InputType type, const
else
{
// select the first widget
Widget* w = GUIEngine::getCurrentScreen()->getFirstWidget();
Widget* w = NULL;
if (ModalDialog::isADialogActive())
{
// TODO : select first widget in modal dialogs
}
else
{
Screen* screen = GUIEngine::getCurrentScreen();
if (screen == NULL) return;
w = screen->getFirstWidget();
}
if(w != NULL)
{
if (playerID == 0)

View File

@ -157,8 +157,8 @@ void InputManager::inputSensing(Input::InputType type, int deviceID, int btnID,
// 3) the new event has the preferred type : TODO - reimplement
// 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;
bool store_new = (abs(value) > m_max_sensed_input ||
m_max_sensed_type == Input::IT_NONE) && abs(value) > Input::MAX_VALUE/2;
// don't store if we're trying to do something like bindings keyboard keys on a gamepad
if(m_mode == INPUT_SENSE_KEYBOARD && type != Input::IT_KEYBOARD) store_new = false;
@ -518,6 +518,7 @@ bool InputManager::input(const SEvent& event)
*
* It is wrong to call it when not in input sensing mode anymore.
*/
/*
Input &InputManager::getSensedInput()
{
assert (m_mode == INPUT_SENSE_KEYBOARD ||
@ -528,7 +529,7 @@ Input &InputManager::getSensedInput()
return *m_sensed_input;
} // getSensedInput
*/
//-----------------------------------------------------------------------------
/** Queries the input driver whether it is in the given expected mode.
*/

View File

@ -88,7 +88,7 @@ public:
void update(float dt);
Input &getSensedInput();
//Input &getSensedInput();
};
extern InputManager *input_manager;