diff --git a/src/framework/backend_glutin.rs b/src/framework/backend_glutin.rs index d89ac39..def7734 100644 --- a/src/framework/backend_glutin.rs +++ b/src/framework/backend_glutin.rs @@ -351,6 +351,18 @@ impl BackendEventLoop for GlutinEventLoop { } _ => (), } + + #[cfg(not(any(target_os = "android", target_os = "horizon")))] + { + if state_ref.settings.window_mode.get_glutin_fullscreen_type() != window.window().fullscreen() { + let fullscreen_type = state_ref.settings.window_mode.get_glutin_fullscreen_type(); + let cursor_visible = state_ref.settings.window_mode.should_display_mouse_cursor(); + + window.window().set_fullscreen(fullscreen_type); + + window.window().set_cursor_visible(cursor_visible); + } + } }); } diff --git a/src/framework/backend_sdl2.rs b/src/framework/backend_sdl2.rs index 79c2c4e..a28e123 100644 --- a/src/framework/backend_sdl2.rs +++ b/src/framework/backend_sdl2.rs @@ -396,13 +396,14 @@ impl BackendEventLoop for SDL2EventLoop { let window = refs.window.window_mut(); let fullscreen_type = state.settings.window_mode.get_sdl2_fullscreen_type(); + let show_cursor = state.settings.window_mode.should_display_mouse_cursor(); window.set_fullscreen(fullscreen_type); window .subsystem() .sdl() .mouse() - .show_cursor(state.settings.window_mode.should_display_mouse_cursor()); + .show_cursor(show_cursor); refs.fullscreen_type = fullscreen_type; } diff --git a/src/game/shared_game_state.rs b/src/game/shared_game_state.rs index afad837..c745b2d 100644 --- a/src/game/shared_game_state.rs +++ b/src/game/shared_game_state.rs @@ -86,6 +86,14 @@ impl WindowMode { } } + #[cfg(feature = "backend-glutin")] + pub fn get_glutin_fullscreen_type(&self) -> Option { + match self { + WindowMode::Windowed => None, + WindowMode::Fullscreen => Some(glutin::window::Fullscreen::Borderless(None)), + } + } + pub fn should_display_mouse_cursor(&self) -> bool { match self { WindowMode::Windowed => true,