43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
+
+
|
controllers = [[OFArray alloc] initWithObject:
[[[OFGameController alloc] of_init] autorelease]];
objc_autoreleasePoolPop(pool);
}
@implementation OFGameController
@dynamic rightAnalogStickPosition;
+ (OFArray OF_GENERIC(OFGameController *) *)controllers
{
static OFOnceControl onceControl = OFOnceControlInitValue;
OFOnce(&onceControl, initControllers);
return [[controllers retain] autorelease];
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
+
|
[pressedButtons addObject: @"C-Stick Down"];
[pressedButtons makeImmutable];
return pressedButtons;
}
- (size_t)numAnalogSticks
- (bool)hasLeftAnalogStick
{
return 1;
return true;
}
- (OFPoint)positionOfAnalogStickWithIndex: (size_t)index
- (bool)hasRightAnalogStick
{
circlePosition pos;
if (index > 0)
@throw [OFOutOfRangeException exception];
return false;
}
- (OFPoint)leftAnalogStickPosition
{
circlePosition pos;
hidCircleRead(&pos);
return OFMakePoint(
(float)pos.dx / (pos.dx < 0 ? -INT16_MIN : INT16_MAX),
(float)pos.dy / (pos.dy < 0 ? -INT16_MIN : INT16_MAX));
}
- (OFString *)description
{
return [OFString stringWithFormat: @"<%@: %@>", self.class, self.name];
}
@end
|