︙ | | | ︙ | |
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#import "OFNumber.h"
#import "OHGameController.h"
#import "OHGameControllerDirectionalPad.h"
#import "OFInvalidArgumentException.h"
@implementation OHCombinedJoyCons
+ (instancetype)gamepadWithLeftJoyCon: (OHGameController *)leftJoyCon
rightJoyCon: (OHGameController *)rightJoyCon
{
return [[[self alloc] initWithLeftJoyCon: leftJoyCon
rightJoyCon: rightJoyCon] autorelease];
}
|
>
>
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#import "OFNumber.h"
#import "OHGameController.h"
#import "OHGameControllerDirectionalPad.h"
#import "OFInvalidArgumentException.h"
@implementation OHCombinedJoyCons
@synthesize buttons = _buttons, directionalPads = _directionalPads;
+ (instancetype)gamepadWithLeftJoyCon: (OHGameController *)leftJoyCon
rightJoyCon: (OHGameController *)rightJoyCon
{
return [[[self alloc] initWithLeftJoyCon: leftJoyCon
rightJoyCon: rightJoyCon] autorelease];
}
|
︙ | | | ︙ | |
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
[buttons removeObjectForKey: @"D-Pad Left"];
[buttons removeObjectForKey: @"D-Pad Right"];
[buttons removeObjectForKey: @"SL"];
[buttons removeObjectForKey: @"SR"];
[buttons makeImmutable];
_buttons = [buttons retain];
_axes = [[OFDictionary alloc] init];
directionalPads =
[OFMutableDictionary dictionaryWithCapacity: 3];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"Left Thumbstick"
xAxis: [_leftJoyCon.axes objectForKey: @"X"]
yAxis: [_leftJoyCon.axes objectForKey: @"Y"]]
|
<
<
|
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
[buttons removeObjectForKey: @"D-Pad Left"];
[buttons removeObjectForKey: @"D-Pad Right"];
[buttons removeObjectForKey: @"SL"];
[buttons removeObjectForKey: @"SR"];
[buttons makeImmutable];
_buttons = [buttons retain];
directionalPads =
[OFMutableDictionary dictionaryWithCapacity: 3];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"Left Thumbstick"
xAxis: [_leftJoyCon.axes objectForKey: @"X"]
yAxis: [_leftJoyCon.axes objectForKey: @"Y"]]
|
︙ | | | ︙ | |
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
return self;
}
- (void)dealloc
{
[_leftJoyCon release];
[_rightJoyCon release];
[super dealloc];
}
- (OHGameControllerButton *)northButton
{
return [_buttons objectForKey: @"X"];
}
- (OHGameControllerButton *)southButton
|
>
>
>
>
>
>
>
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
return self;
}
- (void)dealloc
{
[_leftJoyCon release];
[_rightJoyCon release];
[_buttons release];
[_directionalPads release];
[super dealloc];
}
- (OFDictionary OF_GENERIC(OFString *, OHGameControllerAxis *) *)axes
{
return [OFDictionary dictionary];
}
- (OHGameControllerButton *)northButton
{
return [_buttons objectForKey: @"X"];
}
- (OHGameControllerButton *)southButton
|
︙ | | | ︙ | |
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
}
- (OHGameControllerButton *)homeButton
{
return [_buttons objectForKey: @"Home"];
}
- (OHGameControllerDirectionalPad *)leftThumbStick
{
return [_directionalPads objectForKey: @"Left Thumbstick"];
}
- (OHGameControllerDirectionalPad *)rightThumbStick
{
return [_directionalPads objectForKey: @"Right Thumbstick"];
}
- (OHGameControllerDirectionalPad *)dPad
{
return [_directionalPads objectForKey: @"D-Pad"];
}
@end
|
|
|
|
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
}
- (OHGameControllerButton *)homeButton
{
return [_buttons objectForKey: @"Home"];
}
- (OHGameControllerDirectionalPad *)leftThumbstick
{
return [_directionalPads objectForKey: @"Left Thumbstick"];
}
- (OHGameControllerDirectionalPad *)rightThumbstick
{
return [_directionalPads objectForKey: @"Right Thumbstick"];
}
- (OHGameControllerDirectionalPad *)dPad
{
return [_directionalPads objectForKey: @"D-Pad"];
}
@end
|