Differences From Artifact [6db9de440f]:
- File
src/hid/HIDGameControllerDirectionalPad.m
— part of check-in
[39639cd987]
at
2024-06-02 21:24:25
on branch trunk
— Completely redesign and rewrite ObjFWHID
Right now only evdev is supported, support for others will be added back
later. (user: js, size: 2973) [annotate] [blame] [check-ins using]
To Artifact [f54e2d335a]:
- File
src/hid/OHGameControllerDirectionalPad.m
— part of check-in
[afae3291bf]
at
2024-06-03 19:39:51
on branch trunk
— ObjFWHID: Change prefix to OH
Let's leave 3 letter prefixes to 3rd parties. (user: js, size: 2957) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
15 16 17 18 19 20 21 | * 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" | | | | | | | | | | | | | | | | | | 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 "OHGameControllerDirectionalPad.h" #import "OHGameControllerEmulatedAxis.h" #import "OHGameControllerEmulatedButton.h" @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: (OHGameControllerAxis *)xAxis yAxis: (OHGameControllerAxis *)yAxis { self = [super initWithName: name]; @try { _xAxis = [xAxis retain]; _yAxis = [yAxis retain]; _upButton = [[OHGameControllerEmulatedButton alloc] initWithAxis: _yAxis positive: false]; _downButton = [[OHGameControllerEmulatedButton alloc] initWithAxis: _yAxis positive: true]; _leftButton = [[OHGameControllerEmulatedButton alloc] initWithAxis: _xAxis positive: false]; _rightButton = [[OHGameControllerEmulatedButton alloc] initWithAxis: _xAxis positive: true]; } @catch (id e) { [self release]; @throw e; } return self; } - (instancetype)initWithName: (OFString *)name 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 = [[OHGameControllerEmulatedAxis alloc] initWithNegativeButton: _leftButton positiveButton: _rightButton]; _yAxis = [[OHGameControllerEmulatedAxis alloc] initWithNegativeButton: _upButton positiveButton: _downButton]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |