26 lines
687 B
GDScript
26 lines
687 B
GDScript
extends Node
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if event is InputEventKey:
|
|
print("keyboard")
|
|
if event is InputEventMouseButton:
|
|
print("Mouse")
|
|
elif event is InputEventJoypadButton \
|
|
or (event is InputEventJoypadMotion and abs(event.axis_value) > 0.5):
|
|
print(Input.get_joy_name(event.device))
|
|
|
|
func get_simplified_device_name(raw_name: String) -> String:
|
|
match raw_name:
|
|
"XInput Gamepad", "Xbox Series Controller", "Xbox 360 Controller", \
|
|
"Xbox One Controller":
|
|
return "X BOX"
|
|
|
|
"Sony DualSense", "PS5 Controller", "PS4 Controller", \
|
|
"Nacon Revolution Unlimited Pro Controller":
|
|
return "PS"
|
|
|
|
"Switch":
|
|
return "Switch"
|
|
_:
|
|
return "DEVICE_GENERIC"
|