diff options
| author | Rachel Bryk <RachelBryk@gmail.com> | 2014-08-11 13:43:26 -0400 |
|---|---|---|
| committer | Rachel Bryk <RachelBryk@gmail.com> | 2014-09-03 03:08:09 -0400 |
| commit | 5adbc83453d14b23818442f545ceede0e4548196 (patch) | |
| tree | bdc853c8e073ad09189a8f2811306105d061fbec /Source/Core/InputCommon/ControllerInterface | |
| parent | 64575d565a47e582715aac003d8a0c55cc4ac2ca (diff) | |
Change ControlState typedef to double, and change all related floats/doubles to use it.
Fixes an off by 1 issue related to double->float->double conversion, and eliminates numerous warnings.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
7 files changed, 8 insertions, 8 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index 1ff48877db..ecd5db838c 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -266,7 +266,7 @@ std::string Joystick::Hat::GetName() const ControlState Joystick::Axis::GetState() const { - return std::max(0.0f, ControlState(m_axis - m_base) / m_range); + return std::max(0.0, ControlState(m_axis - m_base) / m_range); } ControlState Joystick::Button::GetState() const diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp index 52960bbc3c..d9728dcbac 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp @@ -298,12 +298,12 @@ ControlState KeyboardMouse::Button::GetState() const ControlState KeyboardMouse::Axis::GetState() const { - return std::max(0.0f, ControlState(m_axis) / m_range); + return std::max(0.0, ControlState(m_axis) / m_range); } ControlState KeyboardMouse::Cursor::GetState() const { - return std::max(0.0f, ControlState(m_axis) / (m_positive ? 1.0f : -1.0f)); + return std::max(0.0, ControlState(m_axis) / (m_positive ? 1.0 : -1.0)); } void KeyboardMouse::Light::SetState(const ControlState state) diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h index 6e1868a4ba..fa4f351cb5 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.h +++ b/Source/Core/InputCommon/ControllerInterface/Device.h @@ -10,7 +10,7 @@ #include "Common/Common.h" // idk in case I wanted to change it to double or something, idk what's best -typedef float ControlState; +typedef double ControlState; namespace ciface { diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp index c28356260d..e93b22826d 100644 --- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp @@ -273,7 +273,7 @@ public: case TOK_OR: return std::max(lhsValue, rhsValue); case TOK_ADD: - return std::min(lhsValue + rhsValue, 1.0f); + return std::min(lhsValue + rhsValue, 1.0); default: assert(false); return 0; diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm index 89642aecf0..98df7c3535 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm @@ -253,7 +253,7 @@ ControlState Keyboard::Key::GetState() const ControlState Keyboard::Cursor::GetState() const { - return std::max(0.0f, ControlState(m_axis) / (m_positive ? 1.0f : -1.0f)); + return std::max(0.0, ControlState(m_axis) / (m_positive ? 1.0 : -1.0)); } ControlState Keyboard::Button::GetState() const diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index c43cd255e8..b745f7b2d4 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -407,7 +407,7 @@ ControlState Joystick::Button::GetState() const ControlState Joystick::Axis::GetState() const { - return std::max(0.0f, ControlState(SDL_JoystickGetAxis(m_js, m_index)) / m_range); + return std::max(0.0, ControlState(SDL_JoystickGetAxis(m_js, m_index)) / m_range); } ControlState Joystick::Hat::GetState() const diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp index 8b68fa80bc..b58c1c81a5 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp @@ -256,7 +256,7 @@ ControlState Device::Trigger::GetState() const ControlState Device::Axis::GetState() const { - return std::max( 0.0f, ControlState(m_axis) / m_range ); + return std::max( 0.0, ControlState(m_axis) / m_range ); } void Device::Motor::SetState(ControlState state) |
