35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
@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
|
|
|
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
@interface OFGameController: OFObject
{
#ifdef OF_LINUX
OFString *_path;
int _fd;
OFString *_name;
OFMutableSet *_buttons, *_pressedButtons;
bool _hasLeftAnalogStick, _hasRightAnalogStick;
OFPoint _leftAnalogStickPosition, _rightAnalogStickPosition;
#endif
}
#ifdef OF_HAVE_CLASS_PROPERTIES
@property (class, readonly, nonatomic)
OFArray <OFGameController *> *controllers;
#endif
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/**
* @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).
*
* @param index The index of the analog stick whose position to return
* @return The current position of the specified analog stick
*/
- (OFPoint)positionOfAnalogStickWithIndex: (size_t)index;
@end
OF_ASSUME_NONNULL_END
|
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
<
<
<
<
<
<
<
<
<
<
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/**
* @brief The currently pressed buttons on the controller.
*/
@property (readonly, nonatomic, copy)
OFSet OF_GENERIC(OFString *) *pressedButtons;
/**
* @brief Whether the controller has a left analog stick.
*/
@property (readonly, nonatomic) bool hasLeftAnalogStick;
/**
* @brief The position of the left analog stick.
*
* The range is from (-1, -1) to (1, 1).
*/
@property (readonly, nonatomic) OFPoint leftAnalogStickPosition;
/**
* @brief Whether the controller has a right analog stick.
*/
@property (readonly, nonatomic) bool hasRightAnalogStick;
/**
* @brief The position of the right analog stick.
*
* The range is from (-1, -1) to (1, 1).
*/
@property (readonly, nonatomic) OFPoint rightAnalogStickPosition;
/**
* @brief Returns the available controllers.
*
* @return The available controllers
*/
+ (OFArray OF_GENERIC(OFGameController *) *)controllers;
- (instancetype)init OF_UNAVAILABLE;
@end
OF_ASSUME_NONNULL_END
|