summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface/Android
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/Android')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp27
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h17
2 files changed, 39 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp
index 2d01d38f23..ef95f9b363 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp
@@ -23,7 +23,7 @@ namespace ciface
namespace Android
{
-void Init( std::vector<ControllerInterface::Device*>& devices )
+void Init( std::vector<Core::Device*>& devices )
{
devices.push_back(new Touchscreen());
}
@@ -48,6 +48,20 @@ Touchscreen::Touchscreen()
AddInput(new Button(ButtonManager::BUTTON_A));
AddInput(new Button(ButtonManager::BUTTON_B));
AddInput(new Button(ButtonManager::BUTTON_START));
+ AddInput(new Button(ButtonManager::BUTTON_X));
+ AddInput(new Button(ButtonManager::BUTTON_Y));
+ AddInput(new Button(ButtonManager::BUTTON_Z));
+ AddInput(new Button(ButtonManager::BUTTON_UP));
+ AddInput(new Button(ButtonManager::BUTTON_DOWN));
+ AddInput(new Button(ButtonManager::BUTTON_LEFT));
+ AddInput(new Button(ButtonManager::BUTTON_RIGHT));
+ AddAnalogInputs(new Axis(ButtonManager::STICK_MAIN_LEFT), new Axis(ButtonManager::STICK_MAIN_RIGHT));
+ AddAnalogInputs(new Axis(ButtonManager::STICK_MAIN_UP), new Axis(ButtonManager::STICK_MAIN_DOWN));
+ AddAnalogInputs(new Axis(ButtonManager::STICK_C_UP), new Axis(ButtonManager::STICK_C_DOWN));
+ AddAnalogInputs(new Axis(ButtonManager::STICK_C_LEFT), new Axis(ButtonManager::STICK_C_RIGHT));
+ AddAnalogInputs(new Axis(ButtonManager::TRIGGER_L), new Axis(ButtonManager::TRIGGER_L));
+ AddAnalogInputs(new Axis(ButtonManager::TRIGGER_R), new Axis(ButtonManager::TRIGGER_R));
+
}
// Buttons and stuff
@@ -62,6 +76,17 @@ ControlState Touchscreen::Button::GetState() const
{
return ButtonManager::GetButtonPressed(m_index);
}
+std::string Touchscreen::Axis::GetName() const
+{
+ std::ostringstream ss;
+ ss << "Axis " << (int)m_index;
+ return ss.str();
+}
+
+ControlState Touchscreen::Axis::GetState() const
+{
+ return ButtonManager::GetAxisValue(m_index);
+}
}
}
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h
index 9bdb52a61d..e38c6a221a 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h
+++ b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h
@@ -17,7 +17,7 @@
#ifndef _CIFACE_ANDROID_H_
#define _CIFACE_ANDROID_H_
-#include "../ControllerInterface.h"
+#include "../Device.h"
#include "Android/ButtonManager.h"
namespace ciface
@@ -25,8 +25,8 @@ namespace ciface
namespace Android
{
-void Init( std::vector<ControllerInterface::Device*>& devices );
-class Touchscreen : public ControllerInterface::Device
+void Init( std::vector<Core::Device*>& devices );
+class Touchscreen : public Core::Device
{
private:
class Button : public Input
@@ -36,7 +36,16 @@ private:
Button(ButtonManager::ButtonType index) : m_index(index) {}
ControlState GetState() const;
private:
- const ButtonManager::ButtonType m_index;
+ const ButtonManager::ButtonType m_index;
+ };
+ class Axis : public Input
+ {
+ public:
+ std::string GetName() const;
+ Axis(ButtonManager::ButtonType index) : m_index(index) {}
+ ControlState GetState() const;
+ private:
+ const ButtonManager::ButtonType m_index;
};
public: