MCPcopy Create free account
hub / github.com/ddnet/ddnet / InitJoysticks

Method InitJoysticks

src/engine/client/input.cpp:110–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void CInput::InitJoysticks()
111{
112 if(!SDL_WasInit(SDL_INIT_JOYSTICK))
113 {
114 if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
115 {
116 dbg_msg("joystick", "Unable to init SDL joystick system: %s", SDL_GetError());
117 return;
118 }
119 }
120
121 const int NumJoysticks = SDL_NumJoysticks();
122 dbg_msg("joystick", "%d joystick(s) found", NumJoysticks);
123 for(int i = 0; i < NumJoysticks; i++)
124 OpenJoystick(i);
125 UpdateActiveJoystick();
126
127 Console()->Chain("inp_controller_guid", ConchainJoystickGuidChanged, this);
128}
129
130bool CInput::OpenJoystick(int JoystickIndex)
131{

Callers

nothing calls this directly

Calls 2

dbg_msgFunction · 0.85
ChainMethod · 0.80

Tested by

no test coverage detected