75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
[super dealloc];
}
- (void)retrieveState
{
u32 keys;
circlePosition pos;
hidScanInput();
keys = hidKeysHeld();
hidCircleRead(&pos);
[_pressedButtons removeAllObjects];
if (keys & KEY_X)
[_pressedButtons addObject: OFGameControllerNorthButton];
if (keys & KEY_B)
[_pressedButtons addObject: OFGameControllerSouthButton];
|
|
|
>
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
[super dealloc];
}
- (void)retrieveState
{
u32 keys;
circlePosition leftPos, rightPos;
hidScanInput();
keys = hidKeysHeld();
hidCircleRead(&leftPos);
hidCstickRead(&rightPos);
[_pressedButtons removeAllObjects];
if (keys & KEY_X)
[_pressedButtons addObject: OFGameControllerNorthButton];
if (keys & KEY_B)
[_pressedButtons addObject: OFGameControllerSouthButton];
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
if (keys & KEY_DRIGHT)
[_pressedButtons addObject: OFGameControllerDPadRightButton];
if (keys & KEY_START)
[_pressedButtons addObject: OFGameControllerStartButton];
if (keys & KEY_SELECT)
[_pressedButtons addObject: OFGameControllerSelectButton];
if (pos.dx > 150)
pos.dx = 150;
if (pos.dx < -150)
pos.dx = -150;
if (pos.dy > 150)
pos.dy = 150;
if (pos.dy < -150)
pos.dy = -150;
_leftAnalogStickPosition = OFMakePoint(
(float)pos.dx / 150, -(float)pos.dy / 150);
_rightAnalogStickPosition = OFMakePoint(
-!!(keys & KEY_CSTICK_LEFT) + !!(keys & KEY_CSTICK_RIGHT),
-!!(keys & KEY_CSTICK_UP) + !!(keys & KEY_CSTICK_DOWN));
}
- (OFString *)name
{
return @"Nintendo 3DS";
}
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
|
<
<
>
|
115
116
117
118
119
120
121
122
123
124
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
|
if (keys & KEY_DRIGHT)
[_pressedButtons addObject: OFGameControllerDPadRightButton];
if (keys & KEY_START)
[_pressedButtons addObject: OFGameControllerStartButton];
if (keys & KEY_SELECT)
[_pressedButtons addObject: OFGameControllerSelectButton];
if (leftPos.dx > 150)
leftPos.dx = 150;
if (leftPos.dx < -150)
leftPos.dx = -150;
if (leftPos.dy > 150)
leftPos.dy = 150;
if (leftPos.dy < -150)
leftPos.dy = -150;
if (rightPos.dx > 150)
rightPos.dx = 150;
if (rightPos.dx < -150)
rightPos.dx = -150;
if (rightPos.dy > 150)
rightPos.dy = 150;
if (rightPos.dy < -150)
rightPos.dy = -150;
_leftAnalogStickPosition = OFMakePoint(
(float)leftPos.dx / 150, -(float)leftPos.dy / 150);
_rightAnalogStickPosition = OFMakePoint(
(float)rightPos.dx / 150, -(float)rightPos.dy / 150);
}
- (OFString *)name
{
return @"Nintendo 3DS";
}
|