1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 07:23:51 +00:00

Fixed thumbstick not releasing properly in GUI mode. I forgot to inject key release

This commit is contained in:
Mads Buvik Sandvei 2020-11-30 23:07:07 +01:00
parent f7ceee7a5e
commit 6c0a02d2c3

View file

@ -647,6 +647,7 @@ namespace MWVR
if (guiMode)
{
MyGUI::KeyCode key = MyGUI::KeyCode::None;
bool onPress = true;
// Axis actions
switch (action->openMWActionCode())
@ -660,6 +661,16 @@ namespace MWVR
{
key = MyGUI::KeyCode::ArrowLeft;
}
if (action->value() < 0.6f && action->previousValue() > 0.6f)
{
key = MyGUI::KeyCode::ArrowRight;
onPress = false;
}
if (action->value() > -0.6f && action->previousValue() < -0.6f)
{
key = MyGUI::KeyCode::ArrowLeft;
onPress = false;
}
break;
case A_MenuUpDown:
if (action->value() > 0.6f && action->previousValue() < 0.6f)
@ -670,6 +681,16 @@ namespace MWVR
{
key = MyGUI::KeyCode::ArrowDown;
}
if (action->value() < 0.6f && action->previousValue() > 0.6f)
{
key = MyGUI::KeyCode::ArrowUp;
onPress = false;
}
if (action->value() > -0.6f && action->previousValue() < -0.6f)
{
key = MyGUI::KeyCode::ArrowDown;
onPress = false;
}
break;
default: break;
}
@ -720,9 +741,16 @@ namespace MWVR
}
if (key != MyGUI::KeyCode::None)
{
if (onPress)
{
MWBase::Environment::get().getWindowManager()->injectKeyPress(key, 0, 0);
}
else
{
MWBase::Environment::get().getWindowManager()->injectKeyRelease(key);
}
}
}
else