ObjFW
OHGameControllerDirectionalPad.h
1 /*
2  * Copyright (c) 2008-2025 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OHGameControllerElement.h"
21 #ifdef OBJFWHID_LOCAL_INCLUDES
22 # import "OFNotification.h"
23 #else
24 # if defined(__has_feature) && __has_feature(modules)
25 @import ObjFW;
26 # else
27 # import <ObjFW/OFNotification.h>
28 # endif
29 #endif
30 #import "OHGameControllerAxis.h"
31 #import "OHGameControllerButton.h"
32 
33 OF_ASSUME_NONNULL_BEGIN
34 
41 OF_SUBCLASSING_RESTRICTED
43 {
44  OHGameControllerAxis *_xAxis, *_yAxis;
45  OHGameControllerButton *_up, *_down, *_left, *_right;
46  enum {
47  OHGameControllerDirectionalPadTypeAxes = 1,
48  OHGameControllerDirectionalPadTypeButtons = 2
49  } _type;
50 }
51 
55 @property (readonly, nonatomic) OHGameControllerAxis *xAxis;
56 
60 @property (readonly, nonatomic) OHGameControllerAxis *yAxis;
61 
65 @property (readonly, nonatomic) OHGameControllerButton *up;
66 
70 @property (readonly, nonatomic) OHGameControllerButton *down;
71 
75 @property (readonly, nonatomic) OHGameControllerButton *left;
76 
80 @property (readonly, nonatomic) OHGameControllerButton *right;
81 @end
82 
83 #ifdef __cplusplus
84 extern "C" {
85 #endif
86 
89 extern const OFNotificationName
90  OHGameControllerDirectionalPadValueDidChangeNotification;
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 OF_ASSUME_NONNULL_END
A button of a game controller.
Definition: OHGameControllerButton.h:39
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:41
An element of a game controller, e.g. a button, an axis or a directional pad.
Definition: OHGameControllerElement.h:40
An axis of a game controller.
Definition: OHGameControllerAxis.h:39
A directional pad or thumb stick of a game controller.
Definition: OHGameControllerDirectionalPad.h:42