Overview
Comment: | OFGameController: More code reuse |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | gamecontroller |
Files: | files | file ages | folders |
SHA3-256: |
764fe0bac3cc387e377d32c91e4d1f47 |
User & Date: | js on 2024-05-18 11:37:49 |
Other Links: | branch diff | manifest | tags |
Context
2024-05-18
| ||
12:06 | OFGameController: Map - to Select and + to Start check-in: c28b5e5208 user: js tags: gamecontroller | |
11:37 | OFGameController: More code reuse check-in: 764fe0bac3 user: js tags: gamecontroller | |
2024-05-15
| ||
22:50 | OFGameController: Use different subclasses check-in: 4ecdef7491 user: js tags: gamecontroller | |
Changes
Modified src/hid/OFEvdevGameController.m from [7d8e2879a0] to [3197bc7111].
︙ | ︙ | |||
596 597 598 599 600 601 602 | if (button == OFGameControllerLeftTriggerButton && _hasLeftTriggerPressure) return _leftTriggerPressure; if (button == OFGameControllerRightTriggerButton && _hasRightTriggerPressure) return _rightTriggerPressure; | < < | < < < | 596 597 598 599 600 601 602 603 604 605 | if (button == OFGameControllerLeftTriggerButton && _hasLeftTriggerPressure) return _leftTriggerPressure; if (button == OFGameControllerRightTriggerButton && _hasRightTriggerPressure) return _rightTriggerPressure; return [super pressureForButton: button]; } @end |
Modified src/hid/OFGameController.m from [c04fc09244] to [d96cd2e808].
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "OFGameController.h" #import "OFArray.h" #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include "OFEvdevGameController.h" #endif #ifdef OF_WINDOWS # include "OFXInputGameController.h" #endif | > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "OFGameController.h" #import "OFArray.h" #import "OFNumber.h" #import "OFSet.h" #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include "OFEvdevGameController.h" #endif #ifdef OF_WINDOWS # include "OFXInputGameController.h" #endif |
︙ | ︙ | |||
122 123 124 125 126 127 128 | - (void)retrieveState { OF_UNRECOGNIZED_SELECTOR } - (float)pressureForButton: (OFGameControllerButton)button { | > > | > > > > > > > > > > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - (void)retrieveState { OF_UNRECOGNIZED_SELECTOR } - (float)pressureForButton: (OFGameControllerButton)button { return ([self.pressedButtons containsObject: button] ? 1 : 0); } - (OFString *)description { if (self.vendorID != nil && self.productID != nil) return [OFString stringWithFormat: @"<%@: %@ [%04X:%04X]>", self.class, self.name, self.vendorID.unsignedShortValue, self.productID.unsignedShortValue]; else return [OFString stringWithFormat: @"<%@: %@>", self.class, self.name]; } @end #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include "OFEvdevGameController.m" #endif #ifdef OF_WINDOWS |
︙ | ︙ |
Modified src/hid/OFNintendo3DSGameController.m from [a67f0beecf] to [ab4d725506].
︙ | ︙ | |||
170 171 172 173 174 175 176 | return true; } - (bool)hasRightAnalogStick { return false; } | < < < < < < < < < < | 170 171 172 173 174 175 176 177 | return true; } - (bool)hasRightAnalogStick { return false; } @end |
Modified src/hid/OFNintendoDSGameController.m from [9294d80bc8] to [ca22ee2dc5].
︙ | ︙ | |||
143 144 145 146 147 148 149 | return false; } - (bool)hasRightAnalogStick { return false; } | < < < < < < < < < < | 143 144 145 146 147 148 149 150 | return false; } - (bool)hasRightAnalogStick { return false; } @end |
Modified src/hid/OFXInputGameController.m from [ba31cb5921] to [a152c52018].
︙ | ︙ | |||
263 264 265 266 267 268 269 | - (float)pressureForButton: (OFGameControllerButton)button { if (button == OFGameControllerLeftTriggerButton) return _leftTriggerPressure; if (button == OFGameControllerRightTriggerButton) return _rightTriggerPressure; | < < | < < < | 263 264 265 266 267 268 269 270 271 272 | - (float)pressureForButton: (OFGameControllerButton)button { if (button == OFGameControllerLeftTriggerButton) return _leftTriggerPressure; if (button == OFGameControllerRightTriggerButton) return _rightTriggerPressure; return [super pressureForButton: button]; } @end |
Modified tests/gamecontroller/GameControllerTests.m from [77c7b12639] to [54bd86368c].
︙ | ︙ | |||
45 46 47 48 49 50 51 | for (OFGameController *controller in controllers) { OFArray OF_GENERIC(OFGameControllerButton) *buttons = controller.buttons.allObjects.sortedArray; size_t i = 0; [OFStdOut setForegroundColor: [OFColor green]]; | < < < < < < < < < < | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | for (OFGameController *controller in controllers) { OFArray OF_GENERIC(OFGameControllerButton) *buttons = controller.buttons.allObjects.sortedArray; size_t i = 0; [OFStdOut setForegroundColor: [OFColor green]]; [OFStdOut writeLine: controller.description]; [controller retrieveState]; for (OFGameControllerButton button in buttons) { float pressure = [controller pressureForButton: button]; |
︙ | ︙ |