mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-25 22:46:32 -04:00
cfadf7607a
* Various Mirror Mode Fixes * Avoid mutating mArrowPos2DX --------- Co-authored-by: Luke Street <luke@street.dev>
30 lines
609 B
C++
30 lines
609 B
C++
#include "dusk/touch_camera.h"
|
|
|
|
namespace dusk::touch_camera {
|
|
namespace {
|
|
float s_yaw_dp = 0.0f;
|
|
float s_pitch_dp = 0.0f;
|
|
} // namespace
|
|
|
|
void add_delta(float yaw_dp, float pitch_dp) noexcept {
|
|
if (getSettings().game.enableMirrorMode) {
|
|
yaw_dp *= -1.0;
|
|
}
|
|
s_yaw_dp += yaw_dp;
|
|
s_pitch_dp += pitch_dp;
|
|
}
|
|
|
|
bool consume_delta(float& yaw_dp, float& pitch_dp) noexcept {
|
|
yaw_dp = s_yaw_dp;
|
|
pitch_dp = s_pitch_dp;
|
|
clear();
|
|
return yaw_dp != 0.0f || pitch_dp != 0.0f;
|
|
}
|
|
|
|
void clear() noexcept {
|
|
s_yaw_dp = 0.0f;
|
|
s_pitch_dp = 0.0f;
|
|
}
|
|
|
|
} // namespace dusk::touch_camera
|