39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
@try {
void *pool = objc_autoreleasePoolPush();
OFMutableDictionary *buttons =
[OFMutableDictionary dictionaryWithCapacity: numButtons];
OFMutableDictionary *directionalPads;
OHGameControllerAxis *xAxis, *yAxis;
OHGameControllerDirectionalPad *directionalPad;
OHGameControllerButton *upButton, *downButton;
OHGameControllerButton *leftButton, *rightButton;
for (size_t i = 0; i < numButtons; i++) {
OHGameControllerButton *button =
[[OHGameControllerButton alloc]
initWithName: buttonNames[i]];
@try {
|
|
<
|
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
@try {
void *pool = objc_autoreleasePoolPush();
OFMutableDictionary *buttons =
[OFMutableDictionary dictionaryWithCapacity: numButtons];
OFMutableDictionary *directionalPads;
OHGameControllerAxis *xAxis, *yAxis;
OHGameControllerDirectionalPad *directionalPad;
OHGameControllerButton *up, *down, *left, *right;
for (size_t i = 0; i < numButtons; i++) {
OHGameControllerButton *button =
[[OHGameControllerButton alloc]
initWithName: buttonNames[i]];
@try {
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"Right Thumbstick"
xAxis: xAxis
yAxis: yAxis] autorelease];
[directionalPads setObject: directionalPad
forKey: @"Right Thumbstick"];
upButton = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Up"] autorelease];
downButton = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Down"] autorelease];
leftButton = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Left"] autorelease];
rightButton = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Right"] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"D-Pad"
upButton: upButton
downButton: downButton
leftButton: leftButton
rightButton: rightButton] autorelease];
[directionalPads setObject: directionalPad forKey: @"D-Pad"];
[directionalPads makeImmutable];
_directionalPads = [directionalPads retain];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
|
|
|
|
|
|
|
|
|
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"Right Thumbstick"
xAxis: xAxis
yAxis: yAxis] autorelease];
[directionalPads setObject: directionalPad
forKey: @"Right Thumbstick"];
up = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Up"] autorelease];
down = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Down"] autorelease];
left = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Left"] autorelease];
right = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Right"] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"D-Pad"
up: up
down: down
left: left
right: right] autorelease];
[directionalPads setObject: directionalPad forKey: @"D-Pad"];
[directionalPads makeImmutable];
_directionalPads = [directionalPads retain];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
|