haskell-game / sdl2

Haskell bindings to the SDL2 library
Other
363 stars 87 forks source link

Should getControllerID be removed? #305

Open asivitz opened 7 months ago

asivitz commented 7 months ago

I tried

  cds <- SDL.availableControllers
  gcs <- for cds SDL.openController
  gcids <- for gcs SDL.getControllerID

which gave me

SDLCallFailed {sdlExceptionCaller = "SDL.Input.GameController.getControllerID", sdlFunction = "SDL_JoystickInstanceID", sdlExceptionError = "Parameter 'joystick' is invalid"}

After a little digging, I see the markdown for getControllerID has

See [SDL_GameControllerInstanceID](https://wiki.libsdl.org/SDL_GameControllerInstanceID) for C documentation.

but that function (SDL_GameControllerInstanceID) doesn't seem to exist.

And the binding actually calls "SDL_JoystickInstanceID" which expects a joystick, not a controller, hence the error.

So what is the point of this function? It doesn't seem to map to any SDL functionality. If the point is to match up a controller to an event, I believe the intention is to use SDL_GameControllerFromInstanceID (basically go the other way from instance id to controller).