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

ske: Gamepad support #122

Closed
marekmaskarinec opened this issue Jan 14, 2024 · 1 comment · Fixed by #171
Closed

ske: Gamepad support #122

marekmaskarinec opened this issue Jan 14, 2024 · 1 comment · Fixed by #171
Assignees
Labels
enhancement New feature or request

Comments

@marekmaskarinec
Copy link
Member

Original issue:

~mrms/tophat#9

Initial message:

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.

ske

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

ske

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

mrms

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?

@skejeton
Copy link
Member

skejeton commented Feb 3, 2024

1.4 goal I think

@skejeton skejeton linked a pull request Mar 29, 2024 that will close this issue
marekmaskarinec pushed a commit that referenced this issue Apr 2, 2024
* Add gamepad support for Windows (#122)

* Add rumble

* Reset rumble every frame

* Rename Player to Gamepad, remove Generic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants