diff --git a/src/common/math_util.h b/src/common/math_util.h index d7cb94a82..bcbbe7000 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -9,8 +9,6 @@ namespace Common { -constexpr float PI = 3.14159265f; - template struct Rectangle { T left{}; diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index db36b6276..d4d09fef7 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "common/math_util.h" #include "common/quaternion.h" #include "common/thread.h" @@ -46,7 +47,7 @@ public: } else { tilt_direction = mouse_move.Cast(); tilt_angle = std::clamp(tilt_direction.Normalize() * sensitivity, 0.0f, - Common::PI * this->tilt_clamp / 180.0f); + std::numbers::pi_v * this->tilt_clamp / 180.0f); } } } @@ -109,7 +110,7 @@ private: // Find the angular rate vector in world space auto angular_rate = ((q - old_q) * inv_q).xyz * 2; - angular_rate *= 1000 / update_millisecond / Common::PI * 180; + angular_rate *= 1000 / update_millisecond / std::numbers::pi_v * 180; // Transform the two vectors from world space to 3DS space gravity = QuaternionRotate(inv_q, gravity); diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index 4f7a78461..9d9c934d5 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp @@ -14,8 +14,8 @@ #include #include #include +#include #include -#include "common/assert.h" #include "common/logging/log.h" #include "common/math_util.h" #include "common/param_package.h" @@ -597,9 +597,10 @@ void SDLState::HandleGameControllerEvent(const SDL_Event& event) { event.csensor.data[2] / SDL_STANDARD_GRAVITY); break; case SDL_SENSOR_GYRO: - joystick->SetGyro(-event.csensor.data[0] * (180.0f / Common::PI), - event.csensor.data[1] * (180.0f / Common::PI), - -event.csensor.data[2] * (180.0f / Common::PI)); + using namespace std::numbers; + joystick->SetGyro(-event.csensor.data[0] * (180.0f / pi), + event.csensor.data[1] * (180.0f / pi), + -event.csensor.data[2] * (180.0f / pi)); break; } }