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:
76 case SDL_JOYBUTTONDOWN:
81 case SDL_JOYHATMOTION:
86 OOLog(
@"handleSDLEvent.unknownEvent",
@"%@",
@"JoystickHandler was sent an event it doesn't know");
67- (BOOL) handleSDLEvent: (SDL_Event *)evt {
…}
100- (NSString *) nameOfJoystick:(NSUInteger)stickNumber
102 return [
NSString stringWithUTF8String:SDL_JoystickName((int)stickNumber)];
100- (NSString *) nameOfJoystick:(NSUInteger)stickNumber {
…}
106- (int16_t) getAxisWithStick:(NSUInteger) stickNum axis:(NSUInteger) axisNum
108 return SDL_JoystickGetAxis(
stick[stickNum], axisNum);
106- (int16_t) getAxisWithStick:(NSUInteger) stickNum axis:(NSUInteger) axisNum {
…}
#define OOLog(class, format,...)
void decodeHatEvent:(JoyHatEvent *evt)
void decodeButtonEvent:(JoyButtonEvent *evt)
void decodeAxisEvent:(JoyAxisEvent *evt)
SDL_Joystick * stick[MAX_STICKS]
NSUInteger joystickCount()