mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
Auto rotate over a square
This commit is contained in:
parent
cc0cfcd336
commit
c70bf66634
@ -1186,12 +1186,13 @@ void EmuScreen::update() {
|
||||
|
||||
if (autoRotatingAnalogCW_) {
|
||||
const float now = time_now_d();
|
||||
__CtrlSetAnalogX(cos(now*-g_Config.fAnalogAutoRotSpeed), 0);
|
||||
__CtrlSetAnalogY(sin(now*-g_Config.fAnalogAutoRotSpeed), 0);
|
||||
// Clamp to a square
|
||||
__CtrlSetAnalogX(std::min(1.0f, std::max(-1.0f, 1.42f*cosf(now*-g_Config.fAnalogAutoRotSpeed))), 0);
|
||||
__CtrlSetAnalogY(std::min(1.0f, std::max(-1.0f, 1.42f*sinf(now*-g_Config.fAnalogAutoRotSpeed))), 0);
|
||||
} else if (autoRotatingAnalogCCW_) {
|
||||
const float now = time_now_d();
|
||||
__CtrlSetAnalogX(cos(now*g_Config.fAnalogAutoRotSpeed), 0);
|
||||
__CtrlSetAnalogY(sin(now*g_Config.fAnalogAutoRotSpeed), 0);
|
||||
__CtrlSetAnalogX(std::min(1.0f, std::max(-1.0f, 1.42f*cosf(now*g_Config.fAnalogAutoRotSpeed))), 0);
|
||||
__CtrlSetAnalogY(std::min(1.0f, std::max(-1.0f, 1.42f*sinf(now*g_Config.fAnalogAutoRotSpeed))), 0);
|
||||
}
|
||||
|
||||
// This is here to support the iOS on screen back button.
|
||||
|
@ -202,8 +202,9 @@ void AnalogRotationButton::Update() {
|
||||
|
||||
if (autoRotating_) {
|
||||
float speed = clockWise_ ? -g_Config.fAnalogAutoRotSpeed : g_Config.fAnalogAutoRotSpeed;
|
||||
__CtrlSetAnalogX(cos(now*speed), 0);
|
||||
__CtrlSetAnalogY(sin(now*speed), 0);
|
||||
// Clamp to a square
|
||||
__CtrlSetAnalogX(std::min(1.0f, std::max(-1.0f, 1.42f*cosf(now*speed))), 0);
|
||||
__CtrlSetAnalogY(std::min(1.0f, std::max(-1.0f, 1.42f*sinf(now*speed))), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user