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

SDL2: game controller (711) #536

Open
3 of 6 tasks
GalacticEmperor1 opened this issue Feb 12, 2023 · 1 comment
Open
3 of 6 tasks

SDL2: game controller (711) #536

GalacticEmperor1 opened this issue Feb 12, 2023 · 1 comment
Labels
Experimental Experimental code joystick pygame.joystick _sdl2 pygame._sdl2

Comments

@GalacticEmperor1
Copy link
Collaborator

GalacticEmperor1 commented Feb 12, 2023

Issue №711 opened by illume at 2019-01-03 11:11:52

Various SDL_GameController functions need to be implemented in _sdl2.
https://wiki.libsdl.org/CategoryGameController

  • an example script
  • examples/eventlist.py
  • Tests for controller are needed
  • CONTROLLER_* consts look a bit long, shorter names are needed I think?
  • Better interface for controller mapping in pygame (ask @husano896 what this is about)
  • docs (API docs, but also a migration guide for people used to the old joystick API).

Comments

# # husano896 commented at 2019-05-14 15:08:04

Better interface for controller mapping in pygame (ask @husano896 what this is about)

https://wiki.libsdl.org/SDL_GameControllerAddMapping

At this moment, mapping uses a really long string as SDL2 like

"341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"

What I think is:

since we can easily get guid and controller name, add mapping should use a easier parameter like

mapping = {
 "a" : "b1",
 "b" : "b2",
 "y" :  "b3",
 "x" : "b0"
 #  etc...
}
controller.add_mapping(mapping)

and so as get_mapping.

mapping = controller.get_mapping() #  return a dict
@GalacticEmperor1 GalacticEmperor1 added _sdl2 pygame._sdl2 Experimental Experimental code hard joystick pygame.joystick labels Feb 12, 2023
@MyreMylar
Copy link
Member

Linking: #2056

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experimental Experimental code joystick pygame.joystick _sdl2 pygame._sdl2
Projects
None yet
Development

No branches or pull requests

3 participants