From 68ae3ee8ae49d40579a30833aeed351c58eec905 Mon Sep 17 00:00:00 2001 From: biroder <107300789+biroder@users.noreply.github.com> Date: Fri, 27 Feb 2026 10:57:38 +0000 Subject: [PATCH] Fix Android multitouch --- src/framework/backend_sdl2.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/framework/backend_sdl2.rs b/src/framework/backend_sdl2.rs index 02b9445..d3a8c27 100644 --- a/src/framework/backend_sdl2.rs +++ b/src/framework/backend_sdl2.rs @@ -414,11 +414,10 @@ impl BackendEventLoop for SDL2EventLoop { ctx.gamepad_context.set_button(which, drs_button, false); } } - Event::FingerDown { touch_id, x, y, .. } | Event::FingerMotion { touch_id, x, y, .. } => { - let touch_id = touch_id as u64; - let state_ref = unsafe { &mut *game.state.get() }; - let mut controls = &mut state_ref.touch_controls; - let scale = state_ref.scale as f64; + Event::FingerDown { finger_id, x, y, .. } | Event::FingerMotion { finger_id, x, y, .. } => { + let touch_id = finger_id as u64; + let mut controls = &mut state.touch_controls; + let scale = state.scale as f64; let loc_x = (x as f64 * ctx.screen_size.0 as f64) / scale; let loc_y = (y as f64 * ctx.screen_size.1 as f64) / scale; @@ -440,10 +439,9 @@ impl BackendEventLoop for SDL2EventLoop { } } } - Event::FingerUp { touch_id, x, y, .. } => { - let touch_id = touch_id as u64; - let state_ref = unsafe { &mut *game.state.get() }; - let mut controls = &mut state_ref.touch_controls; + Event::FingerUp { finger_id, x, y, .. } => { + let touch_id = finger_id as u64; + let mut controls = &mut state.touch_controls; controls.points.retain(|p| p.id != touch_id); controls.clicks.retain(|p| p.id != touch_id);