FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Generic gamepad input
+ Collaboration diagram for Generic gamepad input:

Reads every joystick attached, through SDL (visualization builds only; without visualization the outputs stay zero). It opens the joysticks in RenderInit and polls them in RenderUpdate. Without a joystick it logs a warning and the outputs stay zero.

Mapping from OIS (until 3.0.0) to SDL. The SDL indices are the OIS indices (JoystickInput.h):

Output OIS SDL
XAxis axis 0 / MAX_AXIS, x Inv. SDL_JoystickGetAxis(0) / 32767, x Inv.
YAxis axis 1 / MAX_AXIS SDL_JoystickGetAxis(1) / 32767
XAxisrotation axis 2 / MAX_AXIS, x Inv. SDL_JoystickGetAxis(2) / 32767, x Inv.
YAxisrotation axis 3 / MAX_AXIS SDL_JoystickGetAxis(3) / 32767
ZAxis axis 4 / MAX_AXIS SDL_JoystickGetAxis(4) / 32767
Button1 to Button10 buttons 0 to 9 SDL_JoystickGetButton(0 to 9)
POVVertical/POVHorizontal any POV any hat (SDL_JoystickGetHat)

"x Inv." is x -1 when InvertVertical is true. Other axes, and buttons from 10 on, are ignored. StickyButtons toggles a button output on each press. POVVertical/POVHorizontal: North (SDL_HAT_UP) 1/0, NorthEast (SDL_HAT_RIGHTUP) 1/1, East (SDL_HAT_RIGHT) 0/1, SouthEast (SDL_HAT_RIGHTDOWN) -1/1, South (SDL_HAT_DOWN) -1/0, SouthWest (SDL_HAT_LEFTDOWN) -1/-1, West (SDL_HAT_LEFT) 0/-1, NorthWest (SDL_HAT_LEFTUP) 1/-1, Centered 0/0.