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
116
117
118
119
120
121
|
- (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];
}
- (OFSet *)pressedButtons
{
OFMutableSet *pressedButtons = [OFMutableSet setWithCapacity: 12];
uint32 keys;
scanKeys();
keys = keysCurrent();
if (keys & KEY_A)
[pressedButtons addObject: @"A"];
if (keys & KEY_B)
[pressedButtons addObject: @"A"];
if (keys & KEY_SELECT)
[pressedButtons addObject: @"Select"];
if (keys & KEY_START)
[pressedButtons addObject: @"Start"];
if (keys & KEY_RIGHT)
[pressedButtons addObject: @"D-Pad Right"];
if (keys & KEY_LEFT)
[pressedButtons addObject: @"D-Pad Left"];
if (keys & KEY_UP)
[pressedButtons addObject: @"D-Pad Up"];
if (keys & KEY_DOWN)
[pressedButtons addObject: @"D-Pad Down"];
if (keys & KEY_R)
[pressedButtons addObject: @"R"];
if (keys & KEY_L)
[pressedButtons addObject: @"L"];
if (keys & KEY_X)
[pressedButtons addObject: @"X"];
if (keys & KEY_Y)
[pressedButtons addObject: @"Y"];
[pressedButtons makeImmutable];
return pressedButtons;
}
- (bool)hasLeftAnalogStick
|
|
|
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
116
117
118
119
120
121
122
123
124
125
|
- (OFString *)name
{
return @"Nintendo DS";
}
- (OFSet *)buttons
{
return [OFSet setWithObjects: OFGameControllerButtonA,
OFGameControllerButtonB, OFGameControllerButtonSelect,
OFGameControllerButtonStart, OFGameControllerButtonDPadRight,
OFGameControllerButtonDPadLeft, OFGameControllerButtonDPadUp,
OFGameControllerButtonDPadDown, OFGameControllerButtonR,
OFGameControllerButtonL, OFGameControllerButtonX,
OFGameControllerButtonY, nil];
}
- (OFSet *)pressedButtons
{
OFMutableSet *pressedButtons = [OFMutableSet setWithCapacity: 12];
uint32 keys;
scanKeys();
keys = keysCurrent();
if (keys & KEY_A)
[pressedButtons addObject: OFGameControllerButtonA];
if (keys & KEY_B)
[pressedButtons addObject: OFGameControllerButtonB];
if (keys & KEY_SELECT)
[pressedButtons addObject: OFGameControllerButtonSelect];
if (keys & KEY_START)
[pressedButtons addObject: OFGameControllerButtonStart];
if (keys & KEY_RIGHT)
[pressedButtons addObject: OFGameControllerButtonDPadRight];
if (keys & KEY_LEFT)
[pressedButtons addObject: OFGameControllerButtonDPadLeft];
if (keys & KEY_UP)
[pressedButtons addObject: OFGameControllerButtonDPadUp];
if (keys & KEY_DOWN)
[pressedButtons addObject: OFGameControllerButtonDPadDown];
if (keys & KEY_R)
[pressedButtons addObject: OFGameControllerButtonR];
if (keys & KEY_L)
[pressedButtons addObject: OFGameControllerButtonL];
if (keys & KEY_X)
[pressedButtons addObject: OFGameControllerButtonX];
if (keys & KEY_Y)
[pressedButtons addObject: OFGameControllerButtonY];
[pressedButtons makeImmutable];
return pressedButtons;
}
- (bool)hasLeftAnalogStick
|