Added UI focus tracking

This commit is contained in:
2024-02-25 19:47:13 +01:00
parent dc252ab5d3
commit 44fd041c60
10 changed files with 79 additions and 28 deletions

View File

@ -43,11 +43,9 @@ func _unhandled_input(event):
match event.is_pressed():
true:
DisplayServer.mouse_set_mode(DisplayServer.MOUSE_MODE_CAPTURED)
look_enabled = true
start_look()
false:
DisplayServer.mouse_set_mode(DisplayServer.MOUSE_MODE_VISIBLE)
look_enabled = false
end_look()
func _input(event):
if event.is_action_pressed("zoom_in", true):
@ -96,6 +94,15 @@ func _process(delta):
look_at(center)
func start_look():
DisplayServer.mouse_set_mode(DisplayServer.MOUSE_MODE_CAPTURED)
look_enabled = true
UI.unfocus()
func end_look():
DisplayServer.mouse_set_mode(DisplayServer.MOUSE_MODE_VISIBLE)
look_enabled = false
func on_distance_changed():
target_distance = clampf(target_distance, zoom_min, zoom_max)
Global.camera_attributes.dof_blur_far_distance = target_distance + 1.0