15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
|
* You should have received a copy of the GNU Lesser General Public License
* version 3.0 along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#import "OFGameController.h"
#import "OFArray.h"
#import "OFSet.h"
#import "OFOutOfRangeException.h"
#define id id_3ds
#include <3ds.h>
#undef id
@interface OFGameController ()
- (instancetype)of_init OF_METHOD_FAMILY(init);
@end
static OFArray OF_GENERIC(OFGameController *) *controllers;
static void
initControllers(void)
{
void *pool = objc_autoreleasePoolPush();
controllers = [[OFArray alloc] initWithObject:
[[[OFGameController alloc] of_init] autorelease]];
objc_autoreleasePoolPop(pool);
}
@implementation OFGameController
@synthesize leftAnalogStickPosition = _leftAnalogStickPosition;
@dynamic rightAnalogStickPosition;
+ (OFArray OF_GENERIC(OFGameController *) *)controllers
{
static OFOnceControl onceControl = OFOnceControlInitValue;
OFOnce(&onceControl, initControllers);
return [[controllers retain] autorelease];
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)of_init
{
self = [super init];
@try {
_pressedButtons = [[OFMutableSet alloc] initWithCapacity: 18];
[self retrieveState];
} @catch (id e) {
|
|
<
<
<
<
|
|
<
<
<
<
<
<
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
* You should have received a copy of the GNU Lesser General Public License
* version 3.0 along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#import "OFNintendo3DSGameController.h"
#import "OFArray.h"
#import "OFSet.h"
#import "OFOutOfRangeException.h"
#define id id_3ds
#include <3ds.h>
#undef id
static OFArray OF_GENERIC(OFGameController *) *controllers;
static void
initControllers(void)
{
void *pool = objc_autoreleasePoolPush();
controllers = [[OFArray alloc] initWithObject:
[[[OFNintendo3DSGameController alloc] init] autorelease]];
objc_autoreleasePoolPop(pool);
}
@implementation OFNintendo3DSGameController
@synthesize leftAnalogStickPosition = _leftAnalogStickPosition;
+ (OFArray OF_GENERIC(OFGameController *) *)controllers
{
static OFOnceControl onceControl = OFOnceControlInitValue;
OFOnce(&onceControl, initControllers);
return [[controllers retain] autorelease];
}
- (instancetype)init
{
self = [super init];
@try {
_pressedButtons = [[OFMutableSet alloc] initWithCapacity: 18];
[self retrieveState];
} @catch (id e) {
|
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
}
- (OFString *)name
{
return @"Nintendo 3DS";
}
- (OFNumber *)vendorID
{
return nil;
}
- (OFNumber *)productID
{
return nil;
}
- (OFSet OF_GENERIC(OFGameControllerButton) *)buttons
{
return [OFSet setWithObjects:
OFGameControllerNorthButton,
OFGameControllerSouthButton,
OFGameControllerWestButton,
OFGameControllerEastButton,
|
<
<
<
<
<
<
<
<
<
<
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
}
- (OFString *)name
{
return @"Nintendo 3DS";
}
- (OFSet OF_GENERIC(OFGameControllerButton) *)buttons
{
return [OFSet setWithObjects:
OFGameControllerNorthButton,
OFGameControllerSouthButton,
OFGameControllerWestButton,
OFGameControllerEastButton,
|