Auto rotating analog

This commit is contained in:
iota97 2020-03-23 00:45:22 +01:00
parent edbd01807b
commit 45da319ce7
11 changed files with 77 additions and 2 deletions

View file

@ -665,6 +665,9 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) {
case VIRTKEY_MUTE_TOGGLE:
g_Config.bEnableSound = !g_Config.bEnableSound;
break;
case VIRTKEY_ANALOG_ROTATE:
autoRotatingAnalog_ = true;
break;
}
}
@ -718,6 +721,12 @@ void EmuScreen::onVKeyUp(int virtualKeyCode) {
__CtrlSetRapidFire(false);
break;
case VIRTKEY_ANALOG_ROTATE:
autoRotatingAnalog_ = false;
__CtrlSetAnalogX(0.0f, 0);
__CtrlSetAnalogY(0.0f, 0);
break;
default:
break;
}
@ -1163,6 +1172,12 @@ void EmuScreen::update() {
if (invalid_)
return;
if (autoRotatingAnalog_) {
const float now = time_now_d();
__CtrlSetAnalogX(cos(now*g_Config.fAnalogAutoRotSpeed), 0);
__CtrlSetAnalogY(sin(now*g_Config.fAnalogAutoRotSpeed), 0);
}
// This is here to support the iOS on screen back button.
if (pauseTrigger_) {
pauseTrigger_ = false;