Skip to content

Latest commit

 

History

History
37 lines (22 loc) · 1.49 KB

Devices.md

File metadata and controls

37 lines (22 loc) · 1.49 KB

Detecting Devices

Connect your input indicators to the device_changed signal to be notified when the player uses a new input device. For example:

func _ready() -> void:
    InputHelper.device_changed.connect(_on_input_device_changed)


func _on_input_device_changed(device: String, device_index: int) -> void:
    print("XBox? ", device == InputHelper.DEVICE_XBOX_CONTROLLER)
    print("Device index? ", device_index) # Probably 0

You can also try to guess the controller before any input is registered (thanks @_was):

InputHelper.guess_device_name() # Maybe "xbox" if you have an XBox controller plugged in

The last known controller is available under InputHelper.last_known_joypad_device even if the current device changes to "keyboard".

Granular devicer identifiers

To get more granular names for devices you can enable the "Use granular device identifiers" setting in Project Settings under Input Helper > Devices.

Remapping

To remap input, have a look at Input Mapping.

Device Tester

If you clone the full repository down from GitHub you will have access to the examples folder. In there you can have a look at the device tester examples to test inputs.

Switch Joy-Cons on Windows

While Nintendo Switch Joy-Cons do connect to Windows via Bluetooth and do show up as joypads they don't seem to actually send any input events. They did work in the past so I'm not sure if it's a Windows bug or intentional.