29#define kOOLogUnconvertedNSLog @"unclassified.OOSDLJoystickManager"
40 OOLog(
@"joystick.init",
@"Number of joysticks detected: %ld", (
long)
stickCount);
44 OOLog(
@"joystick.init",
@"Number of joysticks detected exceeds maximum number of joysticks allowed. Setting number of active joysticks to %d.",
MAX_STICKS);
55 stick[i]=SDL_JoystickOpen(i);
58 OOLog(
@"joystick.init",
@"Failed to open joystick #%d", i);
61 SDL_JoystickEventState(SDL_ENABLE);
67- (BOOL) handleSDLEvent: (SDL_Event *)evt
72 case SDL_JOYAXISMOTION:
73 [
self decodeAxisEvent: (JoyAxisEvent *)evt];
76 case SDL_JOYBUTTONDOWN:
78 [
self decodeButtonEvent: (JoyButtonEvent *)evt];
81 case SDL_JOYHATMOTION:
82 [
self decodeHatEvent: (JoyHatEvent *)evt];
86 OOLog(
@"handleSDLEvent.unknownEvent",
@"%@",
@"JoystickHandler was sent an event it doesn't know");
100- (NSString *) nameOfJoystick:(NSUInteger)stickNumber
102 return [NSString stringWithUTF8String:SDL_JoystickName((int)stickNumber)];
106- (int16_t) getAxisWithStick:(NSUInteger) stickNum axis:(NSUInteger) axisNum
108 return SDL_JoystickGetAxis(
stick[stickNum], axisNum);