@@ -84,11 +84,6 @@ void InputHandler::clearJoysticks()
8484 for (auto & ctrl : m_gameControllers) {
8585 SDL_GameControllerClose (ctrl);
8686 }
87- // for (unsigned int i = 0; i < SDL_NumJoysticks();
88- // i++)
89- // {
90- // SDL_GameControllerClose(m_gameControllers[i]);
91- // }
9287 }
9388}
9489
@@ -258,10 +253,6 @@ void InputHandler::onJoyAxisChange(SDL_Event& event) {
258253 {
259254 *m_triggerValues[whichOne].first = abs (event.jaxis .value );
260255 }
261- // else if (event.jaxis.value < -m_joystickDeadZone)
262- // {
263- // m_joystickValues[whichOne].first->setY(-1);
264- // }
265256 else
266257 {
267258 *m_triggerValues[whichOne].first = 0 ;
@@ -305,10 +296,6 @@ void InputHandler::onJoyAxisChange(SDL_Event& event) {
305296 {
306297 *m_triggerValues[whichOne].second = abs (event.jaxis .value );
307298 }
308- // else if (event.jaxis.value < -m_joystickDeadZone)
309- // {
310- // m_joystickValues[whichOne].first->setY(-1);
311- // }
312299 else
313300 {
314301 *m_triggerValues[whichOne].second = 0 ;
@@ -356,14 +343,9 @@ bool InputHandler::mapJoystick(SDL_GameController* ctrl, json mapData) {
356343 SDL_Joystick* joy = SDL_GameControllerGetJoystick (ctrl);
357344 SDL_JoystickGetGUIDString (SDL_JoystickGetGUID (joy), guid, bits);
358345
359- cout << " looking for " << guid << " mapString" << endl;
360346 if (!(mapData[guid]).is_null ()) {
361- cout << " found " << guid << " mapString" << endl;
362347 string mapString = mapData[guid];
363- cout << SDL_GameControllerMappingForGUID (SDL_JoystickGetGUID (joy)) << endl;
364348 int res = SDL_GameControllerAddMapping (mapString.c_str ());
365- cout << " -----------------------------" << endl;
366- cout << SDL_GameControllerMappingForGUID (SDL_JoystickGetGUID (joy)) << endl;
367349
368350 return res == 1 ;
369351 }
@@ -380,7 +362,6 @@ inline void InputHandler::onControllerAddedEvent(const SDL_Event& event)
380362 int idOnExit = m_gameControllers.size ();// su id fisica sera el lugar en el que lo inicialice SDL
381363 int gameId; // Su id del juego sera el id que lea de la id fisica
382364 if (disconnectedGameControllers_.empty ()) {
383- // cout << "Nueva conexion de mando " << m_gameControllers.size() << endl;
384365 initialiseNewController (event.cdevice .which );
385366
386367 // si es un mando nuevo, se corresponden
@@ -389,7 +370,6 @@ inline void InputHandler::onControllerAddedEvent(const SDL_Event& event)
389370 else {
390371 debugFlag_ReconectedController = true ;
391372 int id = disconnectedGameControllers_.front ();
392- // cout << "Reconectado mando " << id << " en sistema" << m_gameControllers.size() << endl;
393373 initialiseNewController (event.cdevice .which );
394374 disconnectedGameControllers_.pop ();
395375
@@ -400,8 +380,6 @@ inline void InputHandler::onControllerAddedEvent(const SDL_Event& event)
400380 systemToGameCtrlId.emplace (idOnExit, gameId);
401381 gameToSystemCtrlId[gameId] = idOnExit;
402382 }
403- else
404- cout << " No puede haber mas de 4 jugadores, desconecta un mando si quieres conectar este" << endl;
405383}
406384
407385inline void InputHandler::onControllerRemovedEvent (const SDL_Event& event)
@@ -413,7 +391,10 @@ inline void InputHandler::onControllerRemovedEvent(const SDL_Event& event)
413391 disconnectedGameControllers_.push (it->second );
414392 systemToGameCtrlId.erase (it);
415393 }
416- else throw " Se ha desconectado un mando no inicializado" ;
394+ else {
395+ // se ha desconectado un mando no inicializado
396+ // eso es malo.
397+ }
417398}
418399
419400inline void InputHandler::initialiseNewController (int idOnEnter)
0 commit comments