pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
825 stars 131 forks source link

Smart default mapping for controller #3088

Open bilhox opened 2 weeks ago

bilhox commented 2 weeks ago

Hello,

While playing with _sdl2.controller, I found that for all controllers I had, default mapping was wrong. Okay, we propose a way for users to set their mapping, but wouldn't be ideal for the comfort of users to propose smart default mapping that matches the button/axis constants proposed by the controller module ?

What I can propose is to do like some people in the SDL community do, keeping a database of the most used controllers in the world with their default mapping.

What do you think ?

damusss commented 2 weeks ago

why not, yeah. maybe enabled by some flag

Starbuck5 commented 2 weeks ago

Wdym it was wrong? Isn’t the whole point of SDLs controller system to map everything to be like an Xbox controller?

bilhox commented 2 weeks ago

Wdym it was wrong? Isn’t the whole point of SDLs controller system to map everything to be like an Xbox controller?

Yes! Sorry for the misunderstanding also, I thought it would also take in account controllers like SNES Controller which looks like this : image

It just doesn't have sticks and shoulders button/trigger.

The button A and B are inverted on my nintendo joycons as well. (when they are combined*) (zoldalma inverted the 2 buttons in his test code)

bilhox commented 2 weeks ago

Someone shared me this on the SDL discord, it might be worth taking a look at it : https://github.com/mdqinc/SDL_GameControllerDB/tree/master