Stabilize camera drag and Tab menu input
This commit is contained in:
parent
86e5980019
commit
bb1942a057
4 changed files with 43 additions and 38 deletions
|
|
@ -20,10 +20,11 @@ func _run() -> void:
|
|||
press.button_index = MOUSE_BUTTON_RIGHT
|
||||
press.button_mask = MOUSE_BUTTON_MASK_RIGHT
|
||||
press.pressed = true
|
||||
player.call("_input", press)
|
||||
Input.parse_input_event(press)
|
||||
await process_frame
|
||||
assert(bool(player.get("_camera_dragging")))
|
||||
if DisplayServer.get_name() != "headless":
|
||||
assert(Input.mouse_mode == Input.MOUSE_MODE_VISIBLE)
|
||||
assert(Input.mouse_mode == Input.MOUSE_MODE_CAPTURED)
|
||||
|
||||
var yaw := player.get_node("%CameraYaw") as Node3D
|
||||
var previous_yaw: float = yaw.rotation.y
|
||||
|
|
@ -31,9 +32,9 @@ func _run() -> void:
|
|||
motion.button_mask = MOUSE_BUTTON_MASK_RIGHT
|
||||
motion.relative = Vector2(18.0, -4.0)
|
||||
motion.screen_relative = motion.relative
|
||||
player.call("_input", motion)
|
||||
assert(not is_equal_approx(yaw.rotation.y, previous_yaw))
|
||||
Input.parse_input_event(motion)
|
||||
await process_frame
|
||||
assert(not is_equal_approx(yaw.rotation.y, previous_yaw))
|
||||
assert(bool(player.get("_camera_dragging")))
|
||||
if DisplayServer.get_name() != "headless":
|
||||
assert(Input.mouse_mode == Input.MOUSE_MODE_CAPTURED)
|
||||
|
|
@ -41,12 +42,14 @@ func _run() -> void:
|
|||
var release := InputEventMouseButton.new()
|
||||
release.button_index = MOUSE_BUTTON_RIGHT
|
||||
release.pressed = false
|
||||
player.call("_input", release)
|
||||
Input.parse_input_event(release)
|
||||
await process_frame
|
||||
assert(not bool(player.get("_camera_dragging")))
|
||||
if DisplayServer.get_name() != "headless":
|
||||
assert(Input.mouse_mode == Input.MOUSE_MODE_VISIBLE)
|
||||
|
||||
player.call("_input", press)
|
||||
Input.parse_input_event(press)
|
||||
await process_frame
|
||||
assert(bool(player.get("_camera_dragging")))
|
||||
player.notification(NOTIFICATION_APPLICATION_FOCUS_OUT)
|
||||
assert(not bool(player.get("_camera_dragging")))
|
||||
|
|
|
|||
|
|
@ -52,6 +52,19 @@ func _run() -> void:
|
|||
presentation.get("_neutral_focus_seed") == standard_button,
|
||||
"the neutral menu focus seed did not remember the first action",
|
||||
)
|
||||
var player_menu_tab := InputEventKey.new()
|
||||
player_menu_tab.physical_keycode = KEY_TAB
|
||||
player_menu_tab.pressed = true
|
||||
presentation._input(player_menu_tab)
|
||||
await process_frame
|
||||
_expect(
|
||||
root.gui_get_focus_owner() == null,
|
||||
"the default player-menu Tab was consumed as focus navigation",
|
||||
)
|
||||
_expect(
|
||||
presentation.get("_neutral_focus_seed") == standard_button,
|
||||
"the default player-menu Tab discarded the neutral focus seed",
|
||||
)
|
||||
var first_navigation := InputEventJoypadButton.new()
|
||||
first_navigation.button_index = JOY_BUTTON_DPAD_DOWN
|
||||
first_navigation.pressed = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue