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
|
* version 3.0 along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#import "OHGameControllerDirectionalPad.h"
#import "OHGameControllerEmulatedAxis.h"
#import "OHGameControllerEmulatedButton.h"
@implementation OHGameControllerDirectionalPad
@synthesize xAxis = _xAxis, yAxis = _yAxis;
@synthesize up = _up, down = _down, left = _left, right = _right;
- (instancetype)initWithName: (OFString *)name
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
xAxis: (OHGameControllerAxis *)xAxis
yAxis: (OHGameControllerAxis *)yAxis
{
self = [super initWithName: name];
@try {
_xAxis = [xAxis retain];
_yAxis = [yAxis retain];
_up = [[OHGameControllerEmulatedButton alloc]
initWithAxis: _yAxis
positive: false];
_down = [[OHGameControllerEmulatedButton alloc]
initWithAxis: _yAxis
positive: true];
_left = [[OHGameControllerEmulatedButton alloc]
initWithAxis: _xAxis
positive: false];
_right = [[OHGameControllerEmulatedButton alloc]
initWithAxis: _xAxis
positive: true];
} @catch (id e) {
[self release];
@throw e;
}
|
|
|
|
|
|
|
|
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
|
* version 3.0 along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#import "OHGameControllerDirectionalPad.h"
#import "OHEmulatedGameControllerAxis.h"
#import "OHEmulatedGameControllerButton.h"
@implementation OHGameControllerDirectionalPad
@synthesize xAxis = _xAxis, yAxis = _yAxis;
@synthesize up = _up, down = _down, left = _left, right = _right;
- (instancetype)initWithName: (OFString *)name
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
xAxis: (OHGameControllerAxis *)xAxis
yAxis: (OHGameControllerAxis *)yAxis
{
self = [super initWithName: name];
@try {
_xAxis = [xAxis retain];
_yAxis = [yAxis retain];
_up = [[OHEmulatedGameControllerButton alloc]
initWithAxis: _yAxis
positive: false];
_down = [[OHEmulatedGameControllerButton alloc]
initWithAxis: _yAxis
positive: true];
_left = [[OHEmulatedGameControllerButton alloc]
initWithAxis: _xAxis
positive: false];
_right = [[OHEmulatedGameControllerButton alloc]
initWithAxis: _xAxis
positive: true];
} @catch (id e) {
[self release];
@throw e;
}
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
@try {
_up = [up retain];
_down = [down retain];
_left = [left retain];
_right = [right retain];
_xAxis = [[OHGameControllerEmulatedAxis alloc]
initWithNegativeButton: _left
positiveButton: _right];
_yAxis = [[OHGameControllerEmulatedAxis alloc]
initWithNegativeButton: _up
positiveButton: _down];
} @catch (id e) {
[self release];
@throw e;
}
|
|
|
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
@try {
_up = [up retain];
_down = [down retain];
_left = [left retain];
_right = [right retain];
_xAxis = [[OHEmulatedGameControllerAxis alloc]
initWithNegativeButton: _left
positiveButton: _right];
_yAxis = [[OHEmulatedGameControllerAxis alloc]
initWithNegativeButton: _up
positiveButton: _down];
} @catch (id e) {
[self release];
@throw e;
}
|