Allow pausing game from gamepad
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9560 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
698962511b
commit
5647c5dadc
@ -257,7 +257,7 @@ void KeyboardConfig::setDefaultBinds()
|
||||
setBinding(PA_RESCUE, Input::IT_KEYBOARD, KEY_BACK);
|
||||
setBinding(PA_FIRE, Input::IT_KEYBOARD, KEY_SPACE);
|
||||
setBinding(PA_LOOK_BACK, Input::IT_KEYBOARD, KEY_KEY_B);
|
||||
|
||||
setBinding(PA_PAUSE_RACE, Input::IT_KEYBOARD, KEY_ESCAPE);
|
||||
|
||||
setBinding(PA_MENU_UP, Input::IT_KEYBOARD, KEY_UP);
|
||||
setBinding(PA_MENU_DOWN, Input::IT_KEYBOARD, KEY_DOWN);
|
||||
@ -299,7 +299,8 @@ void GamepadConfig::setDefaultBinds ()
|
||||
setBinding(PA_DRIFT, Input::IT_STICKBUTTON, 2);
|
||||
setBinding(PA_RESCUE, Input::IT_STICKBUTTON, 3);
|
||||
setBinding(PA_LOOK_BACK, Input::IT_STICKBUTTON, 4);
|
||||
|
||||
setBinding(PA_PAUSE_RACE, Input::IT_STICKBUTTON, 5);
|
||||
|
||||
setBinding(PA_MENU_UP, Input::IT_STICKMOTION, 1, Input::AD_NEGATIVE);
|
||||
setBinding(PA_MENU_DOWN, Input::IT_STICKMOTION, 1, Input::AD_POSITIVE);
|
||||
setBinding(PA_MENU_LEFT, Input::IT_STICKMOTION, 0, Input::AD_NEGATIVE);
|
||||
|
@ -123,6 +123,7 @@ enum PlayerAction
|
||||
PA_RESCUE,
|
||||
PA_FIRE,
|
||||
PA_LOOK_BACK,
|
||||
PA_PAUSE_RACE,
|
||||
|
||||
PA_MENU_UP,
|
||||
PA_MENU_DOWN,
|
||||
@ -135,7 +136,7 @@ enum PlayerAction
|
||||
};
|
||||
|
||||
const PlayerAction PA_FIRST_GAME_ACTION = PA_STEER_LEFT;
|
||||
const PlayerAction PA_LAST_GAME_ACTION = PA_LOOK_BACK;
|
||||
const PlayerAction PA_LAST_GAME_ACTION = PA_PAUSE_RACE;
|
||||
const PlayerAction PA_FIRST_MENU_ACTION = PA_MENU_UP;
|
||||
const PlayerAction PA_LAST_MENU_ACTION = PA_MENU_CANCEL;
|
||||
|
||||
@ -152,6 +153,7 @@ static std::string KartActionStrings[PA_COUNT] = {std::string("steerLeft"),
|
||||
std::string("rescue"),
|
||||
std::string("fire"),
|
||||
std::string("lookBack"),
|
||||
std::string("pauserace"),
|
||||
std::string("menuUp"),
|
||||
std::string("menuDown"),
|
||||
std::string("menuLeft"),
|
||||
|
@ -183,6 +183,9 @@ void PlayerController::action(PlayerAction action, int value)
|
||||
case PA_DRIFT:
|
||||
m_controls->m_drift = (value!=0);
|
||||
break;
|
||||
case PA_PAUSE_RACE:
|
||||
if (value != 0) StateManager::get()->escapePressed();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -131,7 +131,8 @@ void OptionsScreenInput2::init()
|
||||
actions->addItem(KartActionStrings[PA_DRIFT], L"" );
|
||||
actions->addItem(KartActionStrings[PA_LOOK_BACK], L"" );
|
||||
actions->addItem(KartActionStrings[PA_RESCUE], L"" );
|
||||
|
||||
actions->addItem(KartActionStrings[PA_PAUSE_RACE], L"" );
|
||||
|
||||
|
||||
//I18N: Key binding section
|
||||
actions->addItem("menu_keys_section", _("Menu Keys") );
|
||||
@ -168,55 +169,58 @@ void OptionsScreenInput2::updateInputButtons()
|
||||
GUIEngine::ListWidget* actions = this->getWidget<GUIEngine::ListWidget>("actions");
|
||||
assert( actions != NULL );
|
||||
|
||||
// item 0 is a section header
|
||||
int i = 0;
|
||||
i++; // section header
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(1, makeLabel( _("Steer Left"), PA_STEER_LEFT) );
|
||||
actions->renameItem(i++, makeLabel( _("Steer Left"), PA_STEER_LEFT) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(2, makeLabel( _("Steer Right"), PA_STEER_RIGHT) );
|
||||
actions->renameItem(i++, makeLabel( _("Steer Right"), PA_STEER_RIGHT) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(3, makeLabel( _("Accelerate"), PA_ACCEL) );
|
||||
actions->renameItem(i++, makeLabel( _("Accelerate"), PA_ACCEL) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(4, makeLabel( _("Brake"), PA_BRAKE) );
|
||||
actions->renameItem(i++, makeLabel( _("Brake"), PA_BRAKE) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(5, makeLabel( _("Fire"), PA_FIRE) );
|
||||
actions->renameItem(i++, makeLabel( _("Fire"), PA_FIRE) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(6, makeLabel( _("Nitro"), PA_NITRO) );
|
||||
actions->renameItem(i++, makeLabel( _("Nitro"), PA_NITRO) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(7, makeLabel( _("Sharp Turn"), PA_DRIFT) );
|
||||
actions->renameItem(i++, makeLabel( _("Sharp Turn"), PA_DRIFT) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(8, makeLabel( _("Look Back"), PA_LOOK_BACK) );
|
||||
actions->renameItem(i++, makeLabel( _("Look Back"), PA_LOOK_BACK) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(9, makeLabel( _("Rescue"), PA_RESCUE) );
|
||||
|
||||
|
||||
// item 10 is a section header
|
||||
actions->renameItem(i++, makeLabel( _("Rescue"), PA_RESCUE) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(11, makeLabel( _("Up"), PA_MENU_UP) );
|
||||
actions->renameItem(i++, makeLabel( _("Pause Game"), PA_PAUSE_RACE) );
|
||||
|
||||
i++; // section header
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(12, makeLabel( _("Down"), PA_MENU_DOWN) );
|
||||
actions->renameItem(i++, makeLabel( _("Up"), PA_MENU_UP) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(13, makeLabel( _("Left"), PA_MENU_LEFT) );
|
||||
actions->renameItem(i++, makeLabel( _("Down"), PA_MENU_DOWN) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(14, makeLabel( _("Right"), PA_MENU_RIGHT) );
|
||||
actions->renameItem(i++, makeLabel( _("Left"), PA_MENU_LEFT) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(15, makeLabel( _("Select"), PA_MENU_SELECT) );
|
||||
actions->renameItem(i++, makeLabel( _("Right"), PA_MENU_RIGHT) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(16, makeLabel( _("Cancel/Back"), PA_MENU_CANCEL) );
|
||||
actions->renameItem(i++, makeLabel( _("Select"), PA_MENU_SELECT) );
|
||||
|
||||
//I18N: Key binding name
|
||||
actions->renameItem(i++, makeLabel( _("Cancel/Back"), PA_MENU_CANCEL) );
|
||||
|
||||
|
||||
// ---- make sure there are no binding conflicts (same key used for two actions)
|
||||
@ -231,7 +235,7 @@ void OptionsScreenInput2::updateInputButtons()
|
||||
currentlyUsedKeys.insert( item );
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// binding conflict!
|
||||
actions->markItemRed( KartActionStrings[action] );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user