From f35869190bf79afc6352ae5275cdae8e92dff7de Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Thu, 27 Mar 2025 08:55:52 +0100 Subject: [PATCH] gather controller input even without focus (#360) --- src/ui/video.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ui/video.rs b/src/ui/video.rs index 68a944a..df13354 100644 --- a/src/ui/video.rs +++ b/src/ui/video.rs @@ -42,7 +42,13 @@ pub fn init(device: &mut device::Device) { if !unsafe { sdl3_sys::video::SDL_ShowWindow(device.ui.video.window) } { panic!("Could not show window"); } - unsafe { sdl3_sys::everything::SDL_HideCursor() }; + unsafe { + sdl3_sys::everything::SDL_HideCursor(); + sdl3_sys::everything::SDL_SetHint( + sdl3_sys::everything::SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + std::ffi::CString::new("1").unwrap().as_ptr(), + ); + } let gfx_info = GFX_INFO { RDRAM: device.rdram.mem.as_mut_ptr(),