Fix #1170 Add "Don't Assign" option when configuring inputs

This commit is contained in:
Flakebi 2014-10-07 00:06:15 +02:00
parent a4ac9f95c2
commit 0193c4c7a5
4 changed files with 29 additions and 0 deletions

View File

@ -8,6 +8,8 @@
<button id="assignEsc" I18N="When configuring input" text="Assign to ESC key" align="center"/>
<spacer height="10" width="10" />
<button id="assignNone" I18N="When configuring input" text="Assign nothing" align="center"/>
<spacer height="10" width="10" />
<button id="cancel" I18N="When configuring input" text="Press ESC to cancel" align="center"/>
</div>

View File

@ -83,6 +83,10 @@ irr::core::stringw DeviceConfig::getMappingIdString (const PlayerAction action)
returnString += id;
break;
case Input::IT_NONE:
returnString += "none";
break;
default:
assert(false);
returnString += type;

View File

@ -44,6 +44,12 @@ GUIEngine::EventPropagation PressAKeyDialog::processEvent(const std::string& eve
dismiss();
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "assignNone")
{
Input simulatedInput;
OptionsScreenInput2::getInstance()->gotSensedInput(simulatedInput);
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "assignEsc")
{
Input simulatedInput(Input::IT_KEYBOARD, 0 /* deviceID */, KEY_ESCAPE);

View File

@ -447,6 +447,23 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
updateInputButtons();
}
}
else if (sensed_input.m_type == Input::IT_NONE)
{
if (UserConfigParams::logMisc())
{
std::cout << "% Binding " << KartActionStrings[binding_to_set]
<< " : setting to keyboard key NONE\n\n";
}
KeyboardConfig* keyboard = (KeyboardConfig*)m_config;
keyboard->setBinding(binding_to_set, Input::IT_NONE,
sensed_input.m_button_id, Input::AD_NEUTRAL,
Input::AR_HALF,
sensed_input.m_character);
// refresh display
updateInputButtons();
}
else
{
return;