finally cleaned up input method detection
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 21s
Create tag and build when new code gets to main / Test (push) Successful in 6m46s
Create tag and build when new code gets to main / Export (push) Successful in 8m3s

This commit is contained in:
2026-02-16 23:15:25 +01:00
parent 759d972b6d
commit b9ae83cd92
10 changed files with 808 additions and 61 deletions

View File

@@ -31,7 +31,7 @@ class_name InputController
@export var slam:GUIDEAction
signal input_device_changed(is_gamepad: bool)
var _using_gamepad = false
var current_input_method = GlobalHelpers.GamepadDetectionEvent.GAMEPAD
signal input_move(value: Vector3)
signal input_rotate_y(value: float)
@@ -104,19 +104,15 @@ func on_input_slide_ended():
input_slide_ended.emit()
func _input(event: InputEvent) -> void:
if event is InputEventKey:
if _using_gamepad:
_using_gamepad = false
input_device_changed.emit(_using_gamepad)
elif event is InputEventJoypadMotion:
if !_using_gamepad:
if abs(event.axis_value) > 0.5:
_using_gamepad = true
input_device_changed.emit(_using_gamepad)
elif event is InputEventJoypadButton:
if !_using_gamepad:
_using_gamepad = true
input_device_changed.emit(_using_gamepad)
var event_gamepad = GlobalHelpers.is_event_gamepad(event)
if event_gamepad == GlobalHelpers.GamepadDetectionEvent.IRRELEVANT:
return
if current_input_method == event_gamepad:
return
current_input_method = event_gamepad
input_device_changed.emit(current_input_method == GlobalHelpers.GamepadDetectionEvent.GAMEPAD)
func _process(_delta: float) -> void:
var value_horizontal = -move_left.value_axis_1d + move_right.value_axis_1d