summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/jni/emu_window/emu_window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/app/src/main/jni/emu_window/emu_window.cpp')
-rw-r--r--src/android/app/src/main/jni/emu_window/emu_window.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/android/app/src/main/jni/emu_window/emu_window.cpp b/src/android/app/src/main/jni/emu_window/emu_window.cpp
index cef296037..0f6514a61 100644
--- a/src/android/app/src/main/jni/emu_window/emu_window.cpp
+++ b/src/android/app/src/main/jni/emu_window/emu_window.cpp
@@ -10,32 +10,40 @@ void EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) {
render_window = surface;
}
-bool EmuWindow_Android::OnTouchEvent(float x, float y, bool pressed) {
- if (pressed) {
- input_subsystem->GetTouchScreen()->TouchPressed(NormalizeX(x), NormalizeY(y), 0);
- return true;
- }
+void EmuWindow_Android::OnTouchPressed(int id, float x, float y) {
+ const auto [touch_x,touch_y]=MapToTouchScreen(x,y);
+ input_subsystem->GetTouchScreen()->TouchPressed(touch_x, touch_y, id);
+}
- input_subsystem->GetTouchScreen()->ReleaseAllTouch();
- return true;
+void EmuWindow_Android::OnTouchMoved(int id, float x, float y) {
+ const auto [touch_x,touch_y]=MapToTouchScreen(x,y);
+ input_subsystem->GetTouchScreen()->TouchMoved(touch_x, touch_y, id);
}
-void EmuWindow_Android::OnTouchMoved(float x, float y) {
- input_subsystem->GetTouchScreen()->TouchMoved(NormalizeX(x), NormalizeY(y), 0);
+void EmuWindow_Android::OnTouchReleased(int id) {
+ input_subsystem->GetTouchScreen()->TouchReleased(id);
}
-void EmuWindow_Android::OnGamepadEvent(int button_id, bool pressed) {
- input_subsystem->GetVirtualGamepad()->SetButtonState(0, button_id, pressed);
+void EmuWindow_Android::OnGamepadButtonEvent(int player_index, int button_id, bool pressed) {
+ input_subsystem->GetVirtualGamepad()->SetButtonState(player_index, button_id, pressed);
}
-void EmuWindow_Android::OnGamepadMoveEvent(float x, float y) {
+void EmuWindow_Android::OnGamepadJoystickEvent(int player_index, int stick_id, float x, float y) {
input_subsystem->GetVirtualGamepad()->SetStickPosition(
- 0, InputCommon::VirtualGamepad::VirtualStick::Left, x, y);
+ player_index, stick_id, x, y);
+}
+
+void EmuWindow_Android::OnGamepadMotionEvent(int player_index, u64 delta_timestamp, float gyro_x, float gyro_y,
+ float gyro_z, float accel_x, float accel_y,
+ float accel_z) {
+ // TODO:
+ // input_subsystem->GetVirtualGamepad()->SetMotionState(player_index, delta_timestamp, gyro_x, gyro_y,
+ // gyro_z, accel_x, accel_y, accel_z);
}
EmuWindow_Android::EmuWindow_Android(InputCommon::InputSubsystem* input_subsystem_,
ANativeWindow* surface_)
- : input_subsystem{input_subsystem_} {
+ : input_subsystem{input_subsystem_} {
LOG_INFO(Frontend, "initializing");
if (!surface_) {