Overview
Comment: | OFGameController: Map 3DS C stick to right stick |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | gamecontroller |
Files: | files | file ages | folders |
SHA3-256: |
f31e553adecd826a94c8f7ded45baf7b |
User & Date: | js on 2024-05-20 04:35:02 |
Other Links: | branch diff | manifest | tags |
Context
2024-05-20
| ||
09:53 | OFGameController: Support 3DS analog right stick check-in: d5329de5f4 user: js tags: gamecontroller | |
04:35 | OFGameController: Map 3DS C stick to right stick check-in: f31e553ade user: js tags: gamecontroller | |
03:37 | OFStdIOStream: Add two methods for game consoles check-in: d693276d79 user: js tags: gamecontroller | |
Changes
Modified src/hid/OFNintendo3DSGameController.h from [143c577afb] to [600e88c786].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFGameController.h" OF_ASSUME_NONNULL_BEGIN @interface OFNintendo3DSGameController: OFGameController { OFMutableSet OF_GENERIC(OFGameControllerButton) *_pressedButtons; | | | 20 21 22 23 24 25 26 27 28 29 30 31 | #import "OFGameController.h" OF_ASSUME_NONNULL_BEGIN @interface OFNintendo3DSGameController: OFGameController { OFMutableSet OF_GENERIC(OFGameControllerButton) *_pressedButtons; OFPoint _leftAnalogStickPosition, _rightAnalogStickPosition; } @end OF_ASSUME_NONNULL_END |
Modified src/hid/OFNintendo3DSGameController.m from [5dde4675ee] to [ac863f7de3].
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #include <3ds.h> #undef id static OFArray OF_GENERIC(OFGameController *) *controllers; @implementation OFNintendo3DSGameController @synthesize leftAnalogStickPosition = _leftAnalogStickPosition; + (void)initialize { void *pool; if (self != [OFNintendo3DSGameController class]) return; | > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <3ds.h> #undef id static OFArray OF_GENERIC(OFGameController *) *controllers; @implementation OFNintendo3DSGameController @synthesize leftAnalogStickPosition = _leftAnalogStickPosition; @synthesize rightAnalogStickPosition = _rightAnalogStickPosition; + (void)initialize { void *pool; if (self != [OFNintendo3DSGameController class]) return; |
︙ | ︙ | |||
53 54 55 56 57 58 59 | } - (instancetype)init { self = [super init]; @try { | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | } - (instancetype)init { self = [super init]; @try { _pressedButtons = [[OFMutableSet alloc] initWithCapacity: 14]; [self retrieveState]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
112 113 114 115 116 117 118 | [_pressedButtons addObject: OFGameControllerDPadLeftButton]; if (keys & KEY_DRIGHT) [_pressedButtons addObject: OFGameControllerDPadRightButton]; if (keys & KEY_START) [_pressedButtons addObject: OFGameControllerStartButton]; if (keys & KEY_SELECT) [_pressedButtons addObject: OFGameControllerSelectButton]; | < < < < < < < < > > > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | [_pressedButtons addObject: OFGameControllerDPadLeftButton]; if (keys & KEY_DRIGHT) [_pressedButtons addObject: OFGameControllerDPadRightButton]; if (keys & KEY_START) [_pressedButtons addObject: OFGameControllerStartButton]; if (keys & KEY_SELECT) [_pressedButtons addObject: OFGameControllerSelectButton]; if (pos.dx > 150) pos.dx = 150; if (pos.dx < -150) pos.dx = -150; if (pos.dy > 150) pos.dy = 150; if (pos.dy < -150) pos.dy = -150; _leftAnalogStickPosition = OFMakePoint( (float)pos.dx / 150, -(float)pos.dy / 150); _rightAnalogStickPosition = OFMakePoint( -!!(keys & KEY_CSTICK_LEFT) + !!(keys & KEY_CSTICK_RIGHT), -!!(keys & KEY_CSTICK_UP) + !!(keys & KEY_CSTICK_DOWN)); } - (OFString *)name { return @"Nintendo 3DS"; } |
︙ | ︙ | |||
155 156 157 158 159 160 161 | OFGameControllerRightShoulderButton, OFGameControllerLeftShoulderButton, OFGameControllerDPadUpButton, OFGameControllerDPadDownButton, OFGameControllerDPadLeftButton, OFGameControllerDPadRightButton, OFGameControllerStartButton, | | < < < < | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | OFGameControllerRightShoulderButton, OFGameControllerLeftShoulderButton, OFGameControllerDPadUpButton, OFGameControllerDPadDownButton, OFGameControllerDPadLeftButton, OFGameControllerDPadRightButton, OFGameControllerStartButton, OFGameControllerSelectButton, nil]; } - (OFSet OF_GENERIC(OFGameControllerButton) *)pressedButtons { return [[_pressedButtons copy] autorelease]; } - (bool)hasLeftAnalogStick { return true; } - (bool)hasRightAnalogStick { return true; } @end |