-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathBX4ButtonWheelLayout.m
More file actions
99 lines (85 loc) · 4.19 KB
/
BX4ButtonWheelLayout.m
File metadata and controls
99 lines (85 loc) · 4.19 KB
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
70
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
/*
Copyright (c) 2013 Alun Bestor and contributors. All rights reserved.
This source file 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 "BX4ButtonWheelLayout.h"
#import "BXEmulatedJoystick.h"
#if defined(__x86_64__) || defined(__i386__)
@implementation BX4ButtonWheelLayout
+ (void) load
{
[BXJoypadLayout registerLayout: self forJoystickType: [BX4AxisWheel class]];
}
+ (JoypadControllerLayout *)layout
{
static JoypadControllerLayout *layout = nil;
if (!layout)
{
layout = [[JoypadControllerLayout alloc] init];
[layout setName: NSLocalizedString(@"Boxer: 4-button racing wheel", @"Label for 4-button wheel Joypad layout.")];
//We use the accelerometer in lieu of onscreen steering controls
[layout addAccelerometer];
//Gas pedal: blue, rectangular and tall, located along left of screen
[layout addButtonWithFrame: CGRectMake(380,0,100,320)
label: NSLocalizedString(@"Gas", @"Label for gas pedal on Joypad wheel layouts.")
fontSize: 20
shape: kJoyButtonShapeSquare
color: kJoyButtonColorBlue
identifier: kJoyInputRButton];
//Brake pedal: blue, rectangular and tall, located along right of screen
[layout addButtonWithFrame: CGRectMake(0,0,100,320)
label: NSLocalizedString(@"Brake", @"Label for brake pedal on Joypad wheel layouts.")
fontSize: 20
shape: kJoyButtonShapeSquare
color: kJoyButtonColorBlue
identifier: kJoyInputLButton];
//Secondary buttons: circular, arranged in pairs inwards from gas and brake pedals
[layout addButtonWithFrame: CGRectMake(270,200,90,90)
label: @"1"
fontSize: 36
shape: kJoyButtonShapeRound
color: kJoyButtonColorBlack
identifier: kJoyInputAButton];
[layout addButtonWithFrame: CGRectMake(120,200,90,90)
label: @"2"
fontSize: 36
shape: kJoyButtonShapeRound
color: kJoyButtonColorBlack
identifier: kJoyInputBButton];
[layout addButtonWithFrame: CGRectMake(270,100,90,90)
label: @"3"
fontSize: 28
shape: kJoyButtonShapeRound
color: kJoyButtonColorBlack
identifier: kJoyInputXButton];
[layout addButtonWithFrame: CGRectMake(120,100,90,90)
label: @"4"
fontSize: 28
shape: kJoyButtonShapeRound
color: kJoyButtonColorBlack
identifier: kJoyInputYButton];
//Meta buttons: pill-shaped, located at the top center
[layout addButtonWithFrame: CGRectMake(120,10,110,30)
label: NSLocalizedString(@"ESC", @"Label for Escape button on Joypad layouts.")
fontSize: 12
shape: kJoyButtonShapePill
color: kJoyButtonColorBlack
identifier: kJoyInputStartButton];
[layout addButtonWithFrame: CGRectMake(250,10,110,30)
label: NSLocalizedString(@"PAUSE", @"Label for Pause button on Joypad layouts.")
fontSize: 12
shape: kJoyButtonShapePill
color: kJoyButtonColorBlack
identifier: kJoyInputSelectButton];
}
return layout;
}
@end
#else
@implementation BX4ButtonWheelLayout
+ (void) load { }
+ (id) layout { return nil; }
@end
#endif