GameController event documentation

The documentation makes NO mention whatsoever that the event types for game controllers have cbutton and caxis members.

https://wiki.libsdl.org/SDL_ControllerButtonEvent

For joysticks the jbutton and jaxis members are mentioned in the small print.

You are making it incredibly difficult to use these events if you don’t provide the minimum necessary documentation to understand how to code this.

In addition there are NO game controller event code examples.

Also what is the enum label for R2/L2??? Not documented

Not exactly sure what the problem here is - all the supported buttons are listed on https://wiki.libsdl.org/SDL_GameControllerButton which is linked from the documentation you linked.
I don’t know what R2/L2 is, but for the upper shoulder buttons there’s SDL_CONTROLLER_BUTTON_LEFTSHOULDER and ..._RIGHTSHOULDER and the triggers below that are actually axes and are called SDL_CONTROLLER_AXIS_TRIGGERLEFT and ..._TRIGGERRIGHT, see https://wiki.libsdl.org/SDL_ControllerAxisEvent and https://wiki.libsdl.org/SDL_GameControllerAxis (this lists all the supported axes)

The problem is how am I supposed to know to use the member cbutton as in:

if (event.cbutton.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) to read the buttons?

There is not a single mention in the docs about cbutton. However, jbutton for joysticks is explained.

EDIT: I finally found it here: https://wiki.libsdl.org/SDL_Event?highlight=(cbutton)

But it should definitely be mentioned in the other pages you linked, too.

1 Like