/
BX2ButtonJoystickLayout.m
69 lines (56 loc) · 2.64 KB
/
BX2ButtonJoystickLayout.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
/*
Boxer is copyright 2011 Alun Bestor and contributors.
Boxer is released under the GNU General Public License 2.0. A full copy of this license can be
found in this XCode project at Resources/English.lproj/BoxerHelp/pages/legalese.html, or read
online at [http://www.gnu.org/licenses/gpl-2.0.txt].
*/
#import "BX2ButtonJoystickLayout.h"
#import "BXEmulatedJoystick.h"
@implementation BX2ButtonJoystickLayout
+ (void) load
{
[BXJoypadLayout registerLayout: self forJoystickType: [BX2AxisJoystick class]];
}
+ (JoypadControllerLayout *)layout
{
static JoypadControllerLayout *layout = nil;
if (!layout)
{
layout = [[JoypadControllerLayout alloc] init];
[layout setName: NSLocalizedString(@"Boxer: 2-axis, 2-button joystick", @"Label for simple joystick Joypad layout.")];
/*
[layout addAnalogStickWithFrame: CGRectMake(0, 70, 240, 240)
identifier: kJoyInputAnalogStick1];
*/
[layout addDpadWithFrame: CGRectMake(0, 70, 240, 240)
identifier: kJoyInputDpad1];
//Primary buttons: blue, rectangular and tall, located along left of screen
[layout addButtonWithFrame: CGRectMake(380,0,100,320)
label: @"1"
fontSize: 40
shape: kJoyButtonShapeSquare
color: kJoyButtonColorBlue
identifier: kJoyInputAButton];
[layout addButtonWithFrame: CGRectMake(280,0,100,320)
label: @"2"
fontSize: 40
shape: kJoyButtonShapeSquare
color: kJoyButtonColorBlue
identifier: kJoyInputBButton];
//Meta buttons: pill-shaped, located at the top left
[layout addButtonWithFrame: CGRectMake(20,10,110,30)
label: NSLocalizedString(@"ESC", @"Label for Escape button on Joypad layouts.")
fontSize: 12
shape: kJoyButtonShapePill
color: kJoyButtonColorBlack
identifier: kJoyInputStartButton];
[layout addButtonWithFrame: CGRectMake(150,10,110,30)
label: NSLocalizedString(@"PAUSE", @"Label for pause button on Joypad layouts.")
fontSize: 12
shape: kJoyButtonShapePill
color: kJoyButtonColorBlack
identifier: kJoyInputSelectButton];
}
return layout;
}
@end