Differences From Artifact [542208ba0a]:
- File
src/OFGameController.h
— 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: 2203) [annotate] [blame] [check-ins using]
To Artifact [64229ea449]:
- File src/OFGameController.h — part of check-in [6f20cdbd5c] at 2024-05-09 12:57:21 on branch gamecontroller — OFGameController: Add support for Linux (user: js, size: 2412) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFObject.h" #import "OFString.h" OF_ASSUME_NONNULL_BEGIN /** @file */ @class OFSet OF_GENERIC(ObjectType); /** * @brief A class for reading state from a game controller. */ OF_SUBCLASSING_RESTRICTED @interface OFGameController: OFObject #ifdef OF_HAVE_CLASS_PROPERTIES | > > > > > > > > > > > > > | > > > > > > | | > | | < | < < < < < < < | 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 | #import "OFObject.h" #import "OFString.h" OF_ASSUME_NONNULL_BEGIN /** @file */ @class OFArray OF_GENERIC(ObjectType); @class OFMutableSet OF_GENERIC(ObjectType); @class OFSet OF_GENERIC(ObjectType); /** * @brief A class for reading state from a game controller. */ OF_SUBCLASSING_RESTRICTED @interface OFGameController: OFObject { #ifdef OF_LINUX OFString *_path; int _fd; OFString *_name; OFMutableSet *_buttons, *_pressedButtons; size_t _numAnalogSticks; OFPoint _analogStickPositions[2]; #endif } #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) OFArray <OFGameController *> *controllers; #endif /** * @brief The name of the controller. */ @property (readonly, nonatomic, copy) OFString *name; /** * @brief The buttons the controller has. */ @property (readonly, nonatomic, copy) OFSet OF_GENERIC(OFString *) *buttons; /** * @brief The currently pressed buttons on the controller. */ @property (readonly, nonatomic, copy) OFSet OF_GENERIC(OFString *) *pressedButtons; /** * @brief The number of analog sticks the controller has. */ @property (readonly, nonatomic) size_t numAnalogSticks; /** * @brief Returns the available controllers. * * @return The available controllers */ + (OFArray OF_GENERIC(OFGameController *) *)controllers; - (instancetype)init OF_UNAVAILABLE; /** * @brief Returns the current position of the specified analog stick. * * The range is from (-1, -1) to (1, 1). |
︙ | ︙ |