diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-12-12 21:24:39 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-12-12 21:24:39 -0600 |
| commit | 2e1aa64958ec767180e8a592cb51e5caa8db92b8 (patch) | |
| tree | 804ed896cbd25ba9b4e3200be4855887b6cbee88 /Source/Core/InputCommon/Src/ControllerInterface | |
| parent | d7be993889245c913f8da5183182b340c04a087b (diff) | |
[Android] Fix joysticks only capable of right/down movements. Also make it capable of using onscreen joystick even if controller 1 is bound.
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h | 3 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp index ec7a7a2a56..5213b196d1 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp @@ -59,10 +59,10 @@ Touchscreen::Touchscreen(int padID) AddInput(new Button(_padID, ButtonManager::BUTTON_DOWN)); AddInput(new Button(_padID, ButtonManager::BUTTON_LEFT)); AddInput(new Button(_padID, ButtonManager::BUTTON_RIGHT)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_LEFT), new Axis(_padID, ButtonManager::STICK_MAIN_RIGHT)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_UP), new Axis(_padID, ButtonManager::STICK_MAIN_DOWN)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP), new Axis(_padID, ButtonManager::STICK_C_DOWN)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_LEFT), new Axis(_padID, ButtonManager::STICK_C_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_DOWN)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_C_DOWN)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_C_RIGHT)); AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_L), new Axis(_padID, ButtonManager::TRIGGER_L)); AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_R), new Axis(_padID, ButtonManager::TRIGGER_R)); } @@ -88,7 +88,7 @@ std::string Touchscreen::Axis::GetName() const ControlState Touchscreen::Axis::GetState() const { - return ButtonManager::GetAxisValue(_padID, _index); + return ButtonManager::GetAxisValue(_padID, _index) * _neg; } } diff --git a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h index 8b1fd99c23..93e528f013 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h @@ -43,11 +43,12 @@ private: { public: std::string GetName() const; - Axis(int padID, ButtonManager::ButtonType index) : _padID(padID), _index(index) {} + Axis(int padID, ButtonManager::ButtonType index, float neg = 1.0f) : _padID(padID), _index(index), _neg(neg) {} ControlState GetState() const; private: const int _padID; const ButtonManager::ButtonType _index; + const float _neg; }; public: |
