Fix mouse look swallowing by the HUD
Move guard look handling to the _input stage, recapture the cursor on window-focus return and when clicking back into gameplay, and make HUD controls mouse-transparent. Add regression tests for yaw/pitch and HUD mouse filters. Verified under Xvfb with real relative mouse motion. Headless 237/237, Python 94/94, movement smoke 60 fps.
This commit is contained in:
1 parent
f4a53e2d4f
commit
76eb5e3a79
10 files changed
+97
-14
No files matched your search
@@ -356,6 +356,17 @@ func _init() -> void:
|
||||
debug_label.add_theme_font_size_override("font_size", 11)
|
||||
debug_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
add_child(debug_label)
|
||||
_ignore_mouse(self)
|
||||
|
||||
## HUD controls are presentation-only. Leaving the full-screen containers on the
|
||||
## default MOUSE_FILTER_STOP can swallow mouse motion/buttons before the guard's
|
||||
## captured-look input sees them. Make every non-gameplay HUD control inert to
|
||||
## the mouse; modal menus are separate CanvasLayers and keep their own filters.
|
||||
func _ignore_mouse(node: Node) -> void:
|
||||
for child in node.get_children():
|
||||
if child is Control:
|
||||
(child as Control).mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_ignore_mouse(child)
|
||||
|
||||
func set_shift_state(coordinator: Object, scenario: Resource) -> void:
|
||||
top_label.text = scenario.display_name if scenario else "Gig Line"
|
||||
|
||||
Reference in new issue
Block a user