ObjFW  Diff

Differences From Artifact [30201f00f5]:

To Artifact [bd26d85f5f]:


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
76
#include <nds.h>
#undef asm

@interface OFGameController ()
- (instancetype)of_init OF_METHOD_FAMILY(init);
@end

static OFGameController *controller;

static void
initController(void)
{



	controller = [[OFGameController alloc] of_init];


}

@implementation OFGameController
+ (size_t)numControllers
{
	return 1;
}

+ (OFGameController *)controllerWithIndex: (size_t)index
{
	static OFOnceControl onceControl = OFOnceControlInitValue;

	if (index > 0)
		@throw [OFOutOfRangeException exception];

	OFOnce(&onceControl, initController);

	return [[controller retain] autorelease];
}

- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)of_init
{
	return [super init];
}






- (OFSet *)buttons
{
	return [OFSet setWithObjects: @"A", @"B", @"Select", @"Start",
	    @"D-Pad Right", @"D-Pad Left", @"D-Pad Up", @"D-Pad Down", @"R",
	    @"L", @"X", @"Y", nil];
}







|


|

>
>
>
|
>
>



<
<
<
<
|
<



<
<
<
|

|











>
>
>
>
>







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
76
77
78
#include <nds.h>
#undef asm

@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();
}

@implementation OFGameController




+ (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
{
	return [super init];
}

- (OFString *)name
{
	return @"Nintendo DS";
}

- (OFSet *)buttons
{
	return [OFSet setWithObjects: @"A", @"B", @"Select", @"Start",
	    @"D-Pad Right", @"D-Pad Left", @"D-Pad Up", @"D-Pad Down", @"R",
	    @"L", @"X", @"Y", nil];
}
118
119
120
121
122
123
124





125
	return 0;
}

- (OFPoint)positionOfAnalogStickWithIndex: (size_t)index
{
	@throw [OFOutOfRangeException exception];
}





@end







>
>
>
>
>

120
121
122
123
124
125
126
127
128
129
130
131
132
	return 0;
}

- (OFPoint)positionOfAnalogStickWithIndex: (size_t)index
{
	@throw [OFOutOfRangeException exception];
}

- (OFString *)description
{
	return [OFString stringWithFormat: @"<%@: %@>", self.class, self.name];
}
@end