MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / joy_Init

Function joy_Init

ddio/sdljoy.cpp:101–125  ·  view source on GitHub ↗

joystick system initialization

Source from the content-addressed store, hash-verified

99
100// joystick system initialization
101bool joy_Init(bool remote) {
102 // reinitialize joystick if already initialized.
103 joy_Close();
104 if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) {
105 // FIXME: report an error?
106 return false;
107 }
108
109 // check if this OS supports joysticks
110 if (!joyGetNumDevs() && !remote) {
111 return false;
112 }
113
114 // rcg06182000 specific joystick support.
115 if (specificJoy >= 0) {
116 joy_InitStick((tJoystick)specificJoy, NULL);
117 } // if
118 else {
119 // initialize joystick list
120 for (int i = 0; i < MAX_JOYSTICKS; i++) {
121 joy_InitStick((tJoystick)i, NULL);
122 }
123 } // else
124 return true;
125}
126
127void joy_Close() {
128 // initialize joystick list

Callers 1

ddio_InitFunction · 0.85

Calls 3

joy_CloseFunction · 0.85
joyGetNumDevsFunction · 0.85
joy_InitStickFunction · 0.85

Tested by

no test coverage detected