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
|
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
|
-
-
-
+
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
-
-
-
+
+
+
+
-
+
-
+
|
* You should have received a copy of the GNU Lesser General Public License
* version 3.0 along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#import "HIDGameControllerDirectionalPad.h"
#import "HIDGameControllerEmulatedAxis.h"
#import "HIDGameControllerEmulatedButton.h"
#import "OHGameControllerDirectionalPad.h"
#import "OHGameControllerEmulatedAxis.h"
#import "OHGameControllerEmulatedButton.h"
@implementation HIDGameControllerDirectionalPad
@implementation OHGameControllerDirectionalPad
@synthesize xAxis = _xAxis, yAxis = _yAxis;
@synthesize upButton = _upButton, downButton = _downButton;
@synthesize leftButton = _leftButton, rightButton = _rightButton;
- (instancetype)initWithName: (OFString *)name
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
xAxis: (HIDGameControllerAxis *)xAxis
yAxis: (HIDGameControllerAxis *)yAxis
xAxis: (OHGameControllerAxis *)xAxis
yAxis: (OHGameControllerAxis *)yAxis
{
self = [super initWithName: name];
@try {
_xAxis = [xAxis retain];
_yAxis = [yAxis retain];
_upButton = [[HIDGameControllerEmulatedButton alloc]
_upButton = [[OHGameControllerEmulatedButton alloc]
initWithAxis: _yAxis
positive: false];
_downButton = [[HIDGameControllerEmulatedButton alloc]
_downButton = [[OHGameControllerEmulatedButton alloc]
initWithAxis: _yAxis
positive: true];
_leftButton = [[HIDGameControllerEmulatedButton alloc]
_leftButton = [[OHGameControllerEmulatedButton alloc]
initWithAxis: _xAxis
positive: false];
_rightButton = [[HIDGameControllerEmulatedButton alloc]
_rightButton = [[OHGameControllerEmulatedButton alloc]
initWithAxis: _xAxis
positive: true];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (instancetype)initWithName: (OFString *)name
upButton: (HIDGameControllerButton *)upButton
downButton: (HIDGameControllerButton *)downButton
leftButton: (HIDGameControllerButton *)leftButton
rightButton: (HIDGameControllerButton *)rightButton
upButton: (OHGameControllerButton *)upButton
downButton: (OHGameControllerButton *)downButton
leftButton: (OHGameControllerButton *)leftButton
rightButton: (OHGameControllerButton *)rightButton
{
self = [super initWithName: name];
@try {
_upButton = [upButton retain];
_downButton = [downButton retain];
_leftButton = [leftButton retain];
_rightButton = [rightButton retain];
_xAxis = [[HIDGameControllerEmulatedAxis alloc]
_xAxis = [[OHGameControllerEmulatedAxis alloc]
initWithNegativeButton: _leftButton
positiveButton: _rightButton];
_yAxis = [[HIDGameControllerEmulatedAxis alloc]
_yAxis = [[OHGameControllerEmulatedAxis alloc]
initWithNegativeButton: _upButton
positiveButton: _downButton];
} @catch (id e) {
[self release];
@throw e;
}
|