mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
[Android] Gamepad input. Refactor JNI native functions to all pull from a single class instead of everywhere willy-nilly
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user