Skip to content

Conversation

@wjt
Copy link
Member

@wjt wjt commented Oct 13, 2025

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.

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.
@wjt wjt requested a review from a team as a code owner October 13, 2025 10:27
@wjt wjt changed the title Fix default input device when no joypad is connected [1/1] Fix default input device when no joypad is connected Oct 13, 2025
@wjt wjt changed the title [1/1] Fix default input device when no joypad is connected Fix default input device when no joypad is connected Oct 13, 2025
@github-actions
Copy link

Play this branch at https://endlessm.github.io/threadbare/branches/endlessm/wjt/fix-default-input-device-when-no-joypad-is-connected.

(This launches the game from the start, not directly at the change(s) in this pull request.)

Copy link
Collaborator

@manuq manuq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I was about to file a bug about it.

@manuq manuq merged commit dca8bff into main Oct 13, 2025
6 checks passed
@manuq manuq deleted the wjt/fix-default-input-device-when-no-joypad-is-connected branch October 13, 2025 15:48
@wjt
Copy link
Member Author

wjt commented Oct 13, 2025

I'm kind of tempted to make a new release for this, it's an annoying bug in a highlighted feature in v0.1.5. Completely my fault!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants