Commit 705a7cc
committed
Fix default input device when no joypad is connected
In commit 0a547d0 I simplified the way
that our input hint components choose a default device: rather than
reimplementing Input Helper's device detection, we use a pair of
properties from the helper.
Unfortunately I picked the wrong ones: I used last_known_joypad_device
and last_known_joypad_index. As the name suggests, the
last_known_joypad_device will never be "keyboard". Its docstring claims
it will be "" if no gamepad is connected; in fact it is currently
"generic", which I submitted
nathanhoad/godot_input_helper#87 to fix.
As a result, if you have no gamepad connected, then gamepad hints will
always be shown.
Instead, use InputHelper.device and InputHelper.device_index, which are
the type and index of the last device that the player used to control
the game. Before any input events have been received, these default to
joypad 0 if there is a joypad connected, and "keyboard" / -1 if not.1 parent 09abd29 commit 705a7cc
File tree
3 files changed
+3
-12
lines changed- scenes/game_elements/props/hint/input_key
3 files changed
+3
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 83 | + | |
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 31 | + | |
35 | 32 | | |
36 | 33 | | |
37 | 34 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 23 | + | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
| |||
0 commit comments