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

Enable mouse input via gamepad + various mouse improvements #2

Merged
merged 1 commit into from
Mar 4, 2021

Conversation

jdgleaver
Copy link

At present, it is impossible to play mouse enabled games with this core on devices that do not have a physical mouse or touchscreen. This PR adds support for controlling mouse input via a gamepad, with the following new core options:

  • Pointer Device:

    • Mouse: Uses physical mouse for input
    • Touchscreen (Pointer API): Uses pointer API
    • Left Analog: Cursor is controlled using the left analog stick of the gamepad in port 1
    • Right Analog: Cursor is controlled using the right analog stick of the gamepad in port 1
    • D-Pad: Cursor is controlled using the d-pad of the gamepad in port 1 (disables normal d-pad input)
  • Pointer Speed: Allows the relative speed of cursor movement to be controlled for all input modes other than Touchscreen (Pointer API). Cursor position is determined with sub-pixel precision

  • Gamepad Analog Deadzone: Sets the analog stick deadzone (e.g. X360 pads typically need a deadzone of 15% to prevent drift)

Additional gamepad inputs for port 1 are mapped as follows:

  • RetroPad R2: Mouse left click
  • RetroPad L2: Mouse right click
  • RetroPad L: Slows the mouse cursor (for fine control) when using Left Analog, Right Analog or D-Pad for cursor movement

The PR also adds a Mouse Cursor Color option, and fixes 2 mouse-related bugs:

  • The mouse cursor can no longer go off screen, or 'wrap around' from one screen edge to another
  • There is no longer an erroneous offset between the mouse cursor position and the values registered by games

@inactive123 inactive123 merged commit 8e44e38 into libretro:master Mar 4, 2021
@jdgleaver jdgleaver deleted the mouse-improvements branch March 5, 2021 09:51
@RobLoach
Copy link
Member

RobLoach commented Apr 5, 2021

Thanks for the addition, @jdgleaver! Reminds me of ScummVM's emulated mouse pointer. I also really like the use of the enum instead of strings. Nice work!

It looks like this fork is out of sync with libretro:
nesbox/TIC-80@master...libretro:master

Any plans on pushing these changes upstream? There are also changes in TIC-80 that should likely be brought down, like some memory slot fixes. Optimal solution would be to use the original source, but 🤷 ..... Thanks! 👍

@jdgleaver
Copy link
Author

Yes, the repos should be synced. I have a couple of other things I need to look at, and I'm supposed to be on holiday this week (so I'm in trouble with the family if I spend too much time alone on the computer!), but I shall certainly add this to my TODO list - hopefully should be fairly straightforward :)

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.

3 participants