mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-16 18:37:34 +01:00
android: Map touches to touchscreen
I neglected to map touches to the touchscreen when refactoring in the input mapping PR. This fixes that regression.
This commit is contained in:
parent
bdf8aca750
commit
0a3bc6c0cf
@ -23,6 +23,22 @@ void EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) {
|
|||||||
window_info.render_surface = reinterpret_cast<void*>(surface);
|
window_info.render_surface = reinterpret_cast<void*>(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmuWindow_Android::OnTouchPressed(int id, float x, float y) {
|
||||||
|
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
|
||||||
|
EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchPressed(touch_x,
|
||||||
|
touch_y, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmuWindow_Android::OnTouchMoved(int id, float x, float y) {
|
||||||
|
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
|
||||||
|
EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchMoved(touch_x,
|
||||||
|
touch_y, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmuWindow_Android::OnTouchReleased(int id) {
|
||||||
|
EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchReleased(id);
|
||||||
|
}
|
||||||
|
|
||||||
void EmuWindow_Android::OnFrameDisplayed() {
|
void EmuWindow_Android::OnFrameDisplayed() {
|
||||||
if (!m_first_frame) {
|
if (!m_first_frame) {
|
||||||
Common::Android::RunJNIOnFiber<void>(
|
Common::Android::RunJNIOnFiber<void>(
|
||||||
|
@ -38,6 +38,10 @@ public:
|
|||||||
void OnSurfaceChanged(ANativeWindow* surface);
|
void OnSurfaceChanged(ANativeWindow* surface);
|
||||||
void OnFrameDisplayed() override;
|
void OnFrameDisplayed() override;
|
||||||
|
|
||||||
|
void OnTouchPressed(int id, float x, float y);
|
||||||
|
void OnTouchMoved(int id, float x, float y);
|
||||||
|
void OnTouchReleased(int id);
|
||||||
|
|
||||||
std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override {
|
std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override {
|
||||||
return {std::make_unique<GraphicsContext_Android>(m_driver_library)};
|
return {std::make_unique<GraphicsContext_Android>(m_driver_library)};
|
||||||
}
|
}
|
||||||
|
@ -190,8 +190,7 @@ void Java_org_yuzu_yuzu_1emu_features_input_NativeInput_onTouchPressed(JNIEnv* e
|
|||||||
jint j_id, jfloat j_x_axis,
|
jint j_id, jfloat j_x_axis,
|
||||||
jfloat j_y_axis) {
|
jfloat j_y_axis) {
|
||||||
if (EmulationSession::GetInstance().IsRunning()) {
|
if (EmulationSession::GetInstance().IsRunning()) {
|
||||||
EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchPressed(
|
EmulationSession::GetInstance().Window().OnTouchPressed(j_id, j_x_axis, j_y_axis);
|
||||||
j_id, j_x_axis, j_y_axis);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,15 +198,14 @@ void Java_org_yuzu_yuzu_1emu_features_input_NativeInput_onTouchMoved(JNIEnv* env
|
|||||||
jint j_id, jfloat j_x_axis,
|
jint j_id, jfloat j_x_axis,
|
||||||
jfloat j_y_axis) {
|
jfloat j_y_axis) {
|
||||||
if (EmulationSession::GetInstance().IsRunning()) {
|
if (EmulationSession::GetInstance().IsRunning()) {
|
||||||
EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchMoved(
|
EmulationSession::GetInstance().Window().OnTouchMoved(j_id, j_x_axis, j_y_axis);
|
||||||
j_id, j_x_axis, j_y_axis);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_yuzu_yuzu_1emu_features_input_NativeInput_onTouchReleased(JNIEnv* env, jobject j_obj,
|
void Java_org_yuzu_yuzu_1emu_features_input_NativeInput_onTouchReleased(JNIEnv* env, jobject j_obj,
|
||||||
jint j_id) {
|
jint j_id) {
|
||||||
if (EmulationSession::GetInstance().IsRunning()) {
|
if (EmulationSession::GetInstance().IsRunning()) {
|
||||||
EmulationSession::GetInstance().GetInputSubsystem().GetTouchScreen()->TouchReleased(j_id);
|
EmulationSession::GetInstance().Window().OnTouchReleased(j_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user