ObjFW
OHGameController.h
1 /*
2  * Copyright (c) 2008-2024 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 #ifdef OBJFWHID_LOCAL_INCLUDES
21 # import "OFObject.h"
22 # import "OFString.h"
23 #else
24 # if defined(__has_feature) && __has_feature(modules)
25 @import ObjFW;
26 # else
27 # import <ObjFW/OFObject.h>
28 # import <ObjFW/OFString.h>
29 # endif
30 #endif
31 
32 #import "OHGamepad.h"
33 #import "OHExtendedGamepad.h"
34 
35 OF_ASSUME_NONNULL_BEGIN
36 
37 @class OFArray OF_GENERIC(ObjectType);
38 @class OFNumber;
40 
47 {
48  OF_RESERVE_IVARS(OHGameController, 4)
49 }
50 
51 #ifdef OF_HAVE_CLASS_PROPERTIES
52 @property (class, readonly, nonatomic)
53  OFArray <OHGameController *> *controllers;
54 #endif
55 
59 @property (readonly, nonatomic, copy) OFString *name;
60 
64 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFNumber *vendorID;
65 
69 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFNumber *productID;
70 
74 @property (readonly, nonatomic) id <OHGameControllerProfile> profile;
75 
80 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) id <OHGamepad> gamepad;
81 
86 @property OF_NULLABLE_PROPERTY (readonly, nonatomic)
87  id <OHExtendedGamepad> extendedGamepad;
88 
94 + (OFArray OF_GENERIC(OHGameController *) *)controllers;
95 
104 - (void)updateState;
105 @end
106 
107 #ifdef __cplusplus
108 extern "C" {
109 #endif
110 extern const uint16_t OHVendorIDSony;
111 extern const uint16_t OHVendorIDNintendo;
112 extern const uint16_t OHVendorIDGoogle;
113 extern const uint16_t OHProductIDDualShock4;
114 extern const uint16_t OHProductIDDualSense;
115 extern const uint16_t OHProductIDLeftJoyCon;
116 extern const uint16_t OHProductIDRightJoyCon;
117 extern const uint16_t OHProductIDN64Controller;
118 extern const uint16_t OHProductIDStadiaController;
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:107
A class for reading state from a game controller.
Definition: OHGameController.h:46
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
A game controller profile representing a gamepad.
A profile for a OHGameController.
Definition: OHGameControllerProfile.h:37
A class for handling strings.
Definition: OFString.h:142
Provides a way to store a number in an object.
Definition: OFNumber.h:46