~mrms/tophat#9: 
Gamepad support

Gamepad is one of the primary devices for playing videogames. They are usually more responsive and precise than keyboard, which reflects positively on the experience.

Gamepad interface needs:

  • Detecting a gamepad connection/disconnection.
  • Detecting manufacturer/gamepad for displaying button hints.
  • Good enough generic interface for all Gamepads.
    • The developer may tune the controls for specific gamepads if they want to.

Features to support:

  • Analog sticks.
  • Arrow keypad and all the buttons on the Xbox gamepad.

Optional:

  • Gyroscope (PlayStation gamepad only, and there's no way to test it normally without having a physical one, which I won't be able to do).
  • Vibration (Can be used for debugging gamepads, but otherwise not very necessary).

Usually, the generic gamepad interface is the Xbox gamepad, any unknown gamepad should be treated as an Xbox gamepad as a fallback (but also return unknown gamepad manufacturer to the user, so they don't allow it if they don't want to). PlayStation gamepad has a similar layout to Xbox, so it should be fine too.

There's gamepad emulators available, so no original hardware is required.

For Windows, there's XInput API which provides support for gamepads, I'm not sure what's for Linux.

#Generic input method

Most of the time, game developers don't want to wrangle input for both keyboard and gamepad separately, it can be possible for keyboard to also act as a gamepad with a Keyboard "manufacturer". You'll be able to specify a certain layout and the inputs from the keyboard will be translated as if it was a gamepad.

Status
REPORTED
Submitter
~ske
Assigned to
No-one
Submitted
2 years ago
Updated
1 year, 2 months ago
Labels
ENHANCEMENT

~ske 2 years ago

Now that we have sokol, we can try implementing generic gamepad support.

~ske 1 year, 2 months ago

It should be resolved before February, I'm going to work on it.

~mrms 1 year, 2 months ago

I can take over the linux side if you want, but we have to decide on an API first.

Also do you want this to be implemented before the new renderer or after?

Register here or Log in to comment, or comment via email.