summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/jni/emu_window/emu_window.cpp16
-rw-r--r--src/android/app/src/main/jni/emu_window/emu_window.h4
-rw-r--r--src/android/app/src/main/jni/native_input.cpp8
3 files changed, 23 insertions, 5 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 2768a01c9..06db55369 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
@@ -23,6 +23,22 @@ void EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) {
23 window_info.render_surface = reinterpret_cast<void*>(surface); 23 window_info.render_surface = reinterpret_cast<void*>(surface);
24} 24}
25 25
26void EmuWindow_Android::OnTouchPressed(int id, float x, float y) {
27 const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
28 EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchPressed(touch_x,
29 touch_y, id);
30}
31
32void EmuWindow_Android::OnTouchMoved(int id, float x, float y) {
33 const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
34 EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchMoved(touch_x,
35 touch_y, id);
36}
37
38void EmuWindow_Android::OnTouchReleased(int id) {
39 EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchReleased(id);
40}
41
26void EmuWindow_Android::OnFrameDisplayed() { 42void EmuWindow_Android::OnFrameDisplayed() {
27 if (!m_first_frame) { 43 if (!m_first_frame) {
28 Common::Android::RunJNIOnFiber<void>( 44 Common::Android::RunJNIOnFiber<void>(
diff --git a/src/android/app/src/main/jni/emu_window/emu_window.h b/src/android/app/src/main/jni/emu_window/emu_window.h
index 34704ae95..d7b5fc6da 100644
--- a/src/android/app/src/main/jni/emu_window/emu_window.h
+++ b/src/android/app/src/main/jni/emu_window/emu_window.h
@@ -38,6 +38,10 @@ public:
38 void OnSurfaceChanged(ANativeWindow* surface); 38 void OnSurfaceChanged(ANativeWindow* surface);
39 void OnFrameDisplayed() override; 39 void OnFrameDisplayed() override;
40 40
41 void OnTouchPressed(int id, float x, float y);
42 void OnTouchMoved(int id, float x, float y);
43 void OnTouchReleased(int id);
44
41 std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override { 45 std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override {
42 return {std::make_unique<GraphicsContext_Android>(m_driver_library)}; 46 return {std::make_unique<GraphicsContext_Android>(m_driver_library)};
43 } 47 }
diff --git a/src/android/app/src/main/jni/native_input.cpp b/src/android/app/src/main/jni/native_input.cpp
index ddf2f297b..37a65f2b8 100644
--- a/src/android/app/src/main/jni/native_input.cpp
+++ b/src/android/app/src/main/jni/native_input.cpp
@@ -190,8 +190,7 @@ void Java_org_yuzu_yuzu_1emu_features_input_NativeInput_onTouchPressed(JNIEnv* e
190 jint j_id, jfloat j_x_axis, 190 jint j_id, jfloat j_x_axis,
191 jfloat j_y_axis) { 191 jfloat j_y_axis) {
192 if (EmulationSession::GetInstance().IsRunning()) { 192 if (EmulationSession::GetInstance().IsRunning()) {
193 EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchPressed( 193 EmulationSession::GetInstance().Window().OnTouchPressed(j_id, j_x_axis, j_y_axis);
194 j_id, j_x_axis, j_y_axis);
195 } 194 }
196} 195}
197 196
@@ -199,15 +198,14 @@ void Java_org_yuzu_yuzu_1emu_features_input_NativeInput_onTouchMoved(JNIEnv* env
199 jint j_id, jfloat j_x_axis, 198 jint j_id, jfloat j_x_axis,
200 jfloat j_y_axis) { 199 jfloat j_y_axis) {
201 if (EmulationSession::GetInstance().IsRunning()) { 200 if (EmulationSession::GetInstance().IsRunning()) {
202 EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchMoved( 201 EmulationSession::GetInstance().Window().OnTouchMoved(j_id, j_x_axis, j_y_axis);
203 j_id, j_x_axis, j_y_axis);
204 } 202 }
205} 203}
206 204
207void Java_org_yuzu_yuzu_1emu_features_input_NativeInput_onTouchReleased(JNIEnv* env, jobject j_obj, 205void Java_org_yuzu_yuzu_1emu_features_input_NativeInput_onTouchReleased(JNIEnv* env, jobject j_obj,
208 jint j_id) { 206 jint j_id) {
209 if (EmulationSession::GetInstance().IsRunning()) { 207 if (EmulationSession::GetInstance().IsRunning()) {
210 EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchReleased(j_id); 208 EmulationSession::GetInstance().Window().OnTouchReleased(j_id);
211 } 209 }
212} 210}
213 211