Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JoyCursor module #5094

Merged
merged 3 commits into from Apr 16, 2017
Merged

Add JoyCursor module #5094

merged 3 commits into from Apr 16, 2017

Conversation

KeyWeeUsr
Copy link
Contributor

@KeyWeeUsr KeyWeeUsr commented Apr 2, 2017

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:

  • left click
  • right click
  • double click (two clicks)
  • moving the cursor
  • holding the button (+ moving at the same time)
  • selecting
  • scrolling (like with mouse wheel)

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 the Window'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 press Escape, but that's keyboard action (which can be handled by VKeyboard) when trying to escape a TextInput 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 big TextInput 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.

@KeyWeeUsr KeyWeeUsr merged commit 04b1c58 into kivy:master Apr 16, 2017
@KeyWeeUsr KeyWeeUsr deleted the joycursor branch April 16, 2017 20:00
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.

None yet

1 participant