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.
Inspired a little bit by Touchring and Cursor modules, this module uses inputs from joysticks (2+ can navigate it) to create a single (no filtering by joystick ids), mouse-like navigation via axes and buttons. It has implemented:
and all with an option to use only the joystick alone i.e. no
Ctrl+E
to activate it (although possible). A user can activate the module right from the joystick. If used in a game, this module could be (re)created when a player enters a menu and removed completely (stop()
, so that it doesn't listen for joystick input) after the menu actions are finished.There are two ways to activate and two behaviors for that. The cursor is resides at
pos = [ -size[0], -size[1] ]
in the beginning (and when at rest). When the cursor is activated through keyboard (Ctrl+E
), it jumps right to the mouse's position. When activated through joystick such a behavior isn't really good because there are no bounds for the cursor, therefore a player has to be able to reset the cursor, thus when activated from joystick, it'll appear in theWindow
's center.Also it's good to mention that
mouse > joystick
, which means that if mouse moves, the cursor moves with it no matter if it's controlled from joystick. This prevents issues of "losing" the JoyCursor widget in the world and prevents also glitches e.g. if joystick goes crazy for some reason and jams the axes on a specific value i.e. order in the hierarchy by reliability (mouse > joystick
).I've tested it on a
TextInput
and the only "failure" here is pretty much not being able to pressEscape
, but that's keyboard action (which can be handled byVKeyboard
) when trying to escape aTextInput
that's the same size as the Window. However, the JoyCursor is pretty much a simple widget (only position is manipulated), therefore to unfocus such a bigTextInput
it's enough to get out of its area and press left mouse button, which is the core function of this module.For more details see this video comparing mouse and JoyCursor features.