Conversation
e08491c to
c7e57c6
Compare
When the game first starts, an overlay is shown with instructions describing the controls. This was previously purely text-based. Add assets for the controls from the Kenney Input Prompts pack <https://kenney.nl/assets/input-prompts> (CC-0): arrow keys, W A S D, and joypad buttons, for which I chose the Steam Deck assets which are reasonably generic. Rework the HUD to lay out the controls in a grid. Pack the keyboard images and controller images into a TabContainer (with the tabs hidden) which can be used to switch between the two sets of controls. Monitor the Input.joy_connection_changed signal to switch between the two sets of images based on the corresponding controller being connecter or disconnected. This signal is emitted at the start of the game for each connected controller, so we can default to the keyboard tab in each case. It might be nice to detect whether the touch controls are visible and hide the control overlay in that case. This can be done by checking DisplayServer.is_touchscreen_available(), which is what the touch buttons use too. But this isn't a regression: we previously showed keyboard controls even when touch controls were visible. It might also be nice to only show the player two controls if there is a player two. But again this is not a regression.
c7e57c6 to
46a1aed
Compare
manuq
approved these changes
Dec 13, 2024
Contributor
manuq
left a comment
There was a problem hiding this comment.
Nice! Very interesting use of the UI tabs, I would have toggled the nodes visibility myself, but this is better.
manuq
reviewed
Dec 13, 2024
Comment on lines
+34
to
+36
| %PlayerOneJoypad.visible = connected | ||
| 1: | ||
| %PlayerTwoJoypad.visible = connected |
Contributor
There was a problem hiding this comment.
Actually you ended up with the visibility toggle.
Member
Author
There was a problem hiding this comment.
Yes, setting the visible tab as invisible makes the other one visible.
I used to use GtkNotebook like this before GtkStack existed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the game first starts, an overlay is shown with instructions describing the controls. This was previously purely text-based.
Add assets for the controls from the Kenney Input Prompts pack https://kenney.nl/assets/input-prompts (CC-0): arrow keys, W A S D, and joypad buttons, for which I chose the Steam Deck assets which are reasonably generic.
Rework the HUD to lay out the controls in a grid. Pack the keyboard images and controller images into a TabContainer (with the tabs hidden) which can be used to switch between the two sets of controls. Monitor the Input.joy_connection_changed signal to switch between the two sets of images based on the corresponding controller being connecter or disconnected. This signal is emitted at the start of the game for each connected controller, so we can default to the keyboard tab in each case.
It might be nice to detect whether the touch controls are visible and hide the control overlay in that case. This can be done by checking DisplayServer.is_touchscreen_available(), which is what the touch buttons use too. But this isn't a regression: we previously showed keyboard controls even when touch controls were visible.
It might also be nice to only show the player two controls if there is a player two. But again this is not a regression.
Before
After