MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / init

Method init

src/InputManager.cpp:136–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void InputManager::init()
137{
138 if(mJoysticks != NULL)
139 deinit();
140
141 //get current input devices from system
142 inputDevices = getInputDevices();
143
144 SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_TIMER);
145
146 mNumJoysticks = SDL_NumJoysticks();
147 mJoysticks = new SDL_Joystick*[mNumJoysticks];
148 mInputConfigs = new InputConfig*[mNumJoysticks];
149 mPrevAxisValues = new std::map<int, int>[mNumJoysticks];
150
151 for(int i = 0; i < mNumJoysticks; i++)
152 {
153 mJoysticks[i] = SDL_JoystickOpen(i);
154 mInputConfigs[i] = new InputConfig(i);
155
156 for(int k = 0; k < SDL_JoystickNumAxes(mJoysticks[i]); k++)
157 {
158 mPrevAxisValues[i][k] = 0;
159 }
160 }
161
162 mKeyboardInputConfig = new InputConfig(DEVICE_KEYBOARD);
163
164 SDL_JoystickEventState(SDL_ENABLE);
165
166 //start timer for input device polling
167 startPolling();
168
169 loadConfig();
170}
171
172void InputManager::startPolling()
173{

Callers

nothing calls this directly

Calls 1

deinitFunction · 0.70

Tested by

no test coverage detected