Differences From Artifact [5edf21e397]:
- File
src/platform/Nintendo3DS/OFGameController.m
— part of check-in
[498a91a2a4]
at
2024-05-05 19:56:47
on branch gamecontroller
— OFGameController: Rename axis to analog stick
This was just wrong, an analog stick has two axes. (user: js, size: 3517) [annotate] [blame] [check-ins using]
To Artifact [8b137a158f]:
- File src/platform/Nintendo3DS/OFGameController.m — part of check-in [6f20cdbd5c] at 2024-05-09 12:57:21 on branch gamecontroller — OFGameController: Add support for Linux (user: js, size: 3721) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
28 29 30 31 32 33 34 | #include <3ds.h> #undef id @interface OFGameController () - (instancetype)of_init OF_METHOD_FAMILY(init); @end | | | > > > | > > < < < < | < < < < | | > > > > > | 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 | #include <3ds.h> #undef id @interface OFGameController () - (instancetype)of_init OF_METHOD_FAMILY(init); @end static OFArray OF_GENERIC(OFGameController *) *controllers; static void initControllers(void) { void *pool = objc_autoreleasePoolPush(); controllers = [[OFArray alloc] initWithObject: [[[OFGameController alloc] of_init] autorelease]]; objc_autoreleasePoolPop(); } @implementation OFGameController + (OFArray OF_GENERIC(OFGameController *) *)controllers { static OFOnceControl onceControl = OFOnceControlInitValue; OFOnce(&onceControl, initControllers); return [[controllers retain] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_init { return [super init]; } - (OFString *)name { return @"Nintendo 3DS"; } - (OFSet *)buttons { return [OFSet setWithObjects: @"A", @"B", @"Select", @"Start", @"D-Pad Right", @"D-Pad Left", @"D-Pad Up", @"D-Pad Down", @"R", @"L", @"X", @"Y", @"ZL", @"ZR", @"C-Stick Right", @"C-Stick Left", @"C-Stick Up", @"C-Stick Down", nil]; |
︙ | ︙ | |||
137 138 139 140 141 142 143 | if (index > 0) @throw [OFOutOfRangeException exception]; hidCircleRead(&pos); return OFMakePoint( | | | > > > > > | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | if (index > 0) @throw [OFOutOfRangeException exception]; hidCircleRead(&pos); return OFMakePoint( (float)pos.dx / (pos.dx < 0 ? -INT16_MIN : INT16_MAX), (float)pos.dy / (pos.dy < 0 ? -INT16_MIN : INT16_MAX)); } - (OFString *)description { return [OFString stringWithFormat: @"<%@: %@>", self.class, self.name]; } @end |