45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
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]] autorelease];
[buttons setObject: button forKey: buttonNames[i]];
}
[buttons makeImmutable];
_buttons = [buttons retain];
directionalPads =
[OFMutableDictionary dictionaryWithCapacity: 3];
xAxis = [[[OHGameControllerAxis alloc]
initWithName: @"X"] autorelease];
yAxis = [[[OHGameControllerAxis alloc]
initWithName: @"Y"] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"Circle Pad"
xAxis: xAxis
yAxis: yAxis] autorelease];
[directionalPads setObject: directionalPad
forKey: @"Circle Pad"];
xAxis = [[[OHGameControllerAxis alloc]
initWithName: @"CX"] autorelease];
yAxis = [[[OHGameControllerAxis alloc]
initWithName: @"CY"] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"C-Stick"
xAxis: xAxis
yAxis: yAxis] autorelease];
[directionalPads setObject: directionalPad
forKey: @"C-Stick"];
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) {
|
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
>
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
111
112
113
114
115
|
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]
analog: false] autorelease];
[buttons setObject: button forKey: buttonNames[i]];
}
[buttons makeImmutable];
_buttons = [buttons retain];
directionalPads =
[OFMutableDictionary dictionaryWithCapacity: 3];
xAxis = [[[OHGameControllerAxis alloc]
initWithName: @"X"
analog: true] autorelease];
yAxis = [[[OHGameControllerAxis alloc]
initWithName: @"Y"
analog: true] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"Circle Pad"
xAxis: xAxis
yAxis: yAxis
analog: true] autorelease];
[directionalPads setObject: directionalPad
forKey: @"Circle Pad"];
xAxis = [[[OHGameControllerAxis alloc]
initWithName: @"CX"
analog: true] autorelease];
yAxis = [[[OHGameControllerAxis alloc]
initWithName: @"CY"
analog: true] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"C-Stick"
xAxis: xAxis
yAxis: yAxis
analog: true] autorelease];
[directionalPads setObject: directionalPad
forKey: @"C-Stick"];
up = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Up"
analog: false] autorelease];
down = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Down"
analog: false] autorelease];
left = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Left"
analog: false] autorelease];
right = [[[OHGameControllerButton alloc]
initWithName: @"D-Pad Right"
analog: false] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"D-Pad"
up: up
down: down
left: left
right: right
analog: false] autorelease];
[directionalPads setObject: directionalPad forKey: @"D-Pad"];
[directionalPads makeImmutable];
_directionalPads = [directionalPads retain];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
|