aboutsummaryrefslogtreecommitdiff
path: root/client/gui
diff options
context:
space:
mode:
Diffstat (limited to 'client/gui')
-rw-r--r--client/gui/menus/game.gd11
-rw-r--r--client/gui/menus/ingame.gd2
-rw-r--r--client/gui/menus/menu.gd2
3 files changed, 14 insertions, 1 deletions
diff --git a/client/gui/menus/game.gd b/client/gui/menus/game.gd
index a730e385..0466d287 100644
--- a/client/gui/menus/game.gd
+++ b/client/gui/menus/game.gd
@@ -25,6 +25,8 @@ func _ready():
get_tree().get_root().go_back_requested.connect(open_ingame_menu)
super()
transition.set_loading_text(tr("c.menu.game.connecting"))
+
+ Settings.hook_changed_init("gameplay.first_person", "mouse_lock", func (_a): update_mouse_capture())
func _input(_event):
if Input.is_action_just_pressed("ui_menu"):
@@ -55,8 +57,17 @@ func get_shot_path(template: String) -> String:
return "%s/%s" % [path, filename]
func _menu_cover(state):
+ super(state)
game.follow_camera.disable_input_menu = state
game.follow_camera.update_disable_input()
+ update_mouse_capture()
+func _menu_exit():
+ super()
+ Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
+
+func update_mouse_capture():
+ var cap = Settings.read("gameplay.first_person") and not covered
+ Input.mouse_mode = Input.MOUSE_MODE_CAPTURED if cap else Input.MOUSE_MODE_VISIBLE
func open_ingame_menu():
if popup != null: return
diff --git a/client/gui/menus/ingame.gd b/client/gui/menus/ingame.gd
index c9bbead9..133b6d8f 100644
--- a/client/gui/menus/ingame.gd
+++ b/client/gui/menus/ingame.gd
@@ -40,10 +40,12 @@ func _menu_open():
anim.play("activate")
await anim.animation_finished
game.mp.send_idle(true)
+
func _menu_exit():
game.mp.send_idle(false)
anim.play_backwards("activate")
await anim.animation_finished
+
func _menu_cover(state: bool):
if Settings.read("ui.scale_mode") == "disabled": return # TODO perhaps check for overlap than scale_mode
if state: anim.play_backwards("activate")
diff --git a/client/gui/menus/menu.gd b/client/gui/menus/menu.gd
index 0f6e0624..516b64bb 100644
--- a/client/gui/menus/menu.gd
+++ b/client/gui/menus/menu.gd
@@ -67,8 +67,8 @@ func submenu(path: String, data_ = null):
print("Submenu opened ", path)
await submenu_close
print("Submenu closed ", path)
- await _menu_cover(false)
covered = false
+ await _menu_cover(false)
Global.focused_menu = self
_disable_recursive(self, false)
if prev_focus != null: prev_focus.grab_focus()