Skip to content

Commit

Permalink
fix: uncaptured mouse in FPS
Browse files Browse the repository at this point in the history
refers to: #147
  • Loading branch information
Ark2000 committed Nov 23, 2023
1 parent f897d97 commit f037210
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions addons/panku_console/modules/interactive_shell/module.gd
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,25 @@ func init_module():
func():
if gui_mode == InputMode.Window:
if window.visible:
Input.mouse_mode = _previous_mouse_mode
window.hide_window()
else:
_previous_mouse_mode = Input.mouse_mode
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
window.show_window()
elif gui_mode == InputMode.Launcher:
simple_launcher.visible = not simple_launcher.visible
)

# Grab the mouse when the dev console is visible (e.g. FPS games)
window.visibility_changed.connect(
func():
# the mouse is grabbed when the window is visible
if window.visible:
_previous_mouse_mode = Input.mouse_mode
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
# restore the mouse mode when the window is hidden
else:
Input.mouse_mode = _previous_mouse_mode
)

gui_mode = load_module_data("gui_mode", InputMode.Window)
pause_if_input = load_module_data("pause_if_popup", true)
unified_window_visibility = load_module_data("unified_visibility", false)
Expand Down

0 comments on commit f037210

Please sign in to comment.