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

Reads the ship console joystick with SDL device index ConsoleID (OIS JoyStick::getID() until 3.0.0), through SDL (visualization builds only; without visualization the outputs stay zero). It opens the joystick in RenderInit and polls it in RenderUpdate. Without the joystick it logs a warning and the outputs stay at their initial values; the camera is still placed when ControlCamera is true.

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

Input OIS SDL
RudderAngle axis 4 / MAX_AXIS SDL_JoystickGetAxis(4) / 32767
EngineCommandPort axis 0 / MAX_AXIS SDL_JoystickGetAxis(0) / 32767
EngineCommandStarboard slider 0 / MAX_AXIS SDL_JoystickGetAxis(5) / 32767 (slider 0)
Camera control on/off button 0 released SDL button 0 released
Reset camera rotation button 1 released SDL button 1 released
Port, starboard engine on/off buttons 6, 7 released SDL buttons 6, 7 released
Camera 0 to 3 buttons 15 to 18 released SDL buttons 15 to 18 released
Thruster 0, 1, 2 on/off buttons 19, 20, 21 released SDL buttons 19, 20, 21 released
Thruster 0, 1, 2 command +1/20 buttons 3, 4, 9 released SDL buttons 3, 4, 9 released
Thruster 0, 2 command -1/20 buttons 2, 10 released SDL buttons 2, 10 released
Camera rotation POV moved hat moved (SDL_JoystickGetHat)

The axes are read on any axis or slider change. Each POV change adds the direction to the rotation of the active camera: North (SDL_HAT_UP) pitch +1, South (SDL_HAT_DOWN) pitch -1, East (SDL_HAT_RIGHT) yaw +1, West (SDL_HAT_LEFT) yaw -1, and the diagonals both; SouthEast (SDL_HAT_RIGHTDOWN) sets yaw 1 and pitch -1, as before. Button 4 has no thruster 1 decrement, as before.