Fixed backspace in new player dialog dismissing the dialog

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3867 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-08-16 19:25:15 +00:00
parent f3e1dc0550
commit 600ac7ebf5
3 changed files with 24 additions and 8 deletions

View File

@ -383,7 +383,7 @@ bool InputManager::input(const SEvent& event)
//const bool programaticallyGenerated = (event.UserEvent.UserData1 == 666 && event.UserEvent.UserData1 == 999);
const bool programaticallyGenerated = false; //event.EventType == EET_KEY_INPUT_EVENT && (event.KeyInput.Char == 666);
if(event.EventType == EET_JOYSTICK_INPUT_EVENT)
{
// Axes - FIXME, instead of checking all of them, ask the bindings which ones to poll
@ -446,11 +446,18 @@ bool InputManager::input(const SEvent& event)
if(event.KeyInput.PressedDown)
{
// escape is a little special
if(key == KEY_ESCAPE)
if (key == KEY_ESCAPE)
{
StateManager::get()->escapePressed();
return true;
}
// 'backspace' in a modal dialog must never be mapped, since user can be in a text
// area trying to erase text (and if it's mapped to rescue that would dismiss the
// dialog instead of erasing a single letter)
if (key == KEY_BACK && GUIEngine::ModalDialog::isADialogActive())
{
return false;
}
input(Input::IT_KEYBOARD, 0, key,
// FIXME: not sure why this happens: with plib the unicode
@ -495,7 +502,8 @@ bool InputManager::input(const SEvent& event)
}
#endif
return getDeviceList()->playerAssignMode() != NO_ASSIGN; // block events in all modes but initial menus
// block events in all modes but initial menus (except for modal dialogs to allow for typing text)
return getDeviceList()->playerAssignMode() != NO_ASSIGN && !GUIEngine::ModalDialog::isADialogActive();
}
//-----------------------------------------------------------------------------

View File

@ -502,7 +502,8 @@ void initRest()
race_manager->setNumLaps (3);
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
race_manager->setMinorMode (RaceManager::MINOR_MODE_QUICK_RACE);
race_manager->setDifficulty(RaceManager::RD_HARD);
race_manager->setDifficulty((RaceManager::Difficulty)(int)UserConfigParams::m_difficulty);
// race_manager->setDifficulty(RaceManager::RD_HARD);
//menu_manager= new MenuManager();

View File

@ -157,12 +157,10 @@ void StateManager::menuEventRaceSetup(Widget* widget, const std::string& name)
{
RibbonWidget* w = getCurrentScreen()->getWidget<RibbonWidget>("difficulty");
assert( w != NULL );
w->setSelection(UserConfigParams::m_difficulty);
race_manager->setDifficulty( (RaceManager::Difficulty)(int)UserConfigParams::m_difficulty );
w->setSelection( race_manager->getDifficulty() );
SpinnerWidget* kartamount = getCurrentScreen()->getWidget<SpinnerWidget>("aikartamount");
race_manager->setNumKarts( kartamount->getValue() + 1 );
kartamount->setValue( race_manager->getNumKarts() - race_manager->getNumPlayers() );
RibbonGridWidget* w2 = getCurrentScreen()->getWidget<RibbonGridWidget>("gamemode");
assert( w2 != NULL );
@ -193,11 +191,20 @@ void StateManager::menuEventRaceSetup(Widget* widget, const std::string& name)
const std::string& selection = w->getSelectionIDString();
if(selection == "novice")
{
UserConfigParams::m_difficulty = RaceManager::RD_EASY;
race_manager->setDifficulty(RaceManager::RD_EASY);
}
else if(selection == "intermediate")
{
UserConfigParams::m_difficulty = RaceManager::RD_MEDIUM;
race_manager->setDifficulty(RaceManager::RD_MEDIUM);
}
else if(selection == "expert")
{
UserConfigParams::m_difficulty = RaceManager::RD_HARD;
race_manager->setDifficulty(RaceManager::RD_HARD);
}
}
else if(name == "gamemode")
{