error handling

This commit is contained in:
Glenn Maynard
2003-02-23 06:26:33 +00:00
parent 37a8a897cf
commit ba744f1eae
+8
View File
@@ -45,12 +45,20 @@ RageInput::RageInput()
for( int i=0; i<iNumJoySticks; i++ )
{
SDL_Joystick *pJoystick = SDL_JoystickOpen( i );
if(pJoystick == NULL) {
LOG->Info(" %d: '%s' Error opening: %s",
i, SDL_JoystickName(i), SDL_GetError());
continue;
}
LOG->Info( " %d: '%s' axes: %d, hats: %d, buttons: %d",
i,
SDL_JoystickName(i),
SDL_JoystickNumAxes(pJoystick),
SDL_JoystickNumHats(pJoystick),
SDL_JoystickNumButtons(pJoystick) );
/* For some weird reason, we won't get any joystick events at all
* if we don't keep the joystick open. (Why? The joystick event
* API is completely separate from the SDL_Joystick polling API ...) */