mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 18:45:38 +00:00
Ability to unbind controls in settings menu
This commit is contained in:
parent
690a237896
commit
0836680e36
1 changed files with 19 additions and 4 deletions
|
@ -77,7 +77,12 @@ namespace MWInput
|
|||
// Disallow binding escape key
|
||||
if (key == SDL_SCANCODE_ESCAPE)
|
||||
{
|
||||
// Stop binding if esc pressed
|
||||
// Unbind if esc pressed
|
||||
if (mDetectingKeyboard)
|
||||
clearAllKeyBindings(mInputBinder, control);
|
||||
else
|
||||
clearAllControllerBindings(mInputBinder, control);
|
||||
control->setInitialValue(0.0f);
|
||||
mInputBinder->cancelDetectingBindingState();
|
||||
MWBase::Environment::get().getWindowManager()->notifyInputActionBound();
|
||||
return;
|
||||
|
@ -154,6 +159,13 @@ namespace MWInput
|
|||
return;
|
||||
clearAllControllerBindings(mInputBinder, control);
|
||||
control->setInitialValue(0.0f);
|
||||
if (button == SDL_CONTROLLER_BUTTON_START)
|
||||
{
|
||||
// Disallow rebinding SDL_CONTROLLER_BUTTON_START - it is used to open main and without it is not
|
||||
// even possible to exit the game (or change the binding back).
|
||||
mInputBinder->cancelDetectingBindingState();
|
||||
}
|
||||
else
|
||||
ICS::DetectingBindingListener::joystickButtonBindingDetected(ICS, deviceID, control, button, direction);
|
||||
MWBase::Environment::get().getWindowManager()->notifyInputActionBound();
|
||||
}
|
||||
|
@ -178,8 +190,11 @@ namespace MWInput
|
|||
mListener = std::make_unique<BindingsListener>(mInputBinder.get(), this);
|
||||
mInputBinder->setDetectingBindingListener(mListener.get());
|
||||
|
||||
if (!userFileExists)
|
||||
{
|
||||
loadKeyDefaults();
|
||||
loadControllerDefaults();
|
||||
}
|
||||
|
||||
for (int i = 0; i < A_Last; ++i)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue