Differences From Artifact [1d9492427b]:
- File
src/hid/OHGameControllerEmulatedButton.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: 1618) [annotate] [blame] [check-ins using]
To Artifact [eefaf93827]:
- File src/hid/OHGameControllerEmulatedButton.m — part of check-in [c45b04b1f8] at 2024-06-04 23:51:18 on branch trunk — Add OHGamepad (user: js, size: 1606) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 | */ #include "config.h" #import "OHGameControllerEmulatedButton.h" #import "OHGameControllerAxis.h" | | < | | 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 | */ #include "config.h" #import "OHGameControllerEmulatedButton.h" #import "OHGameControllerAxis.h" @implementation OHGameControllerEmulatedButton - (instancetype)initWithName: (OFString *)name { OF_INVALID_INIT_METHOD } - (instancetype)initWithAxis: (OHGameControllerAxis *)axis positive: (bool)positive { void *pool = objc_autoreleasePoolPush(); OFString *name; @try { name = [OFString stringWithFormat: @"%@%c", axis.name, (positive ? '+' : '-')]; } @catch (id e) { [self release]; @throw e; } self = [super initWithName: name]; |
︙ | ︙ | |||
63 64 65 66 67 68 69 70 | - (bool)isPressed { if (_positive) return (_axis.value > 0); else return (_axis.value < 0); } @end | > > > > > | 62 63 64 65 66 67 68 69 70 71 72 73 74 | - (bool)isPressed { if (_positive) return (_axis.value > 0); else return (_axis.value < 0); } - (float)value { return (self.isPressed ? 1 : 0); } @end |