orx  1.14
Portable Game Engine
orxJoystick.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2022 Orx-Project
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  *
18  * 2. Altered source versions must be plainly marked as such, and must not be
19  * misrepresented as being the original software.
20  *
21  * 3. This notice may not be removed or altered from any source
22  * distribution.
23  */
24 
43 #ifndef _orxJOYSTICK_H_
44 #define _orxJOYSTICK_H_
45 
46 #include "orxInclude.h"
47 #include "plugin/orxPluginCore.h"
48 
51 #define orxJOYSTICK_GET_AXIS(AXIS, ID) ((((orxU32)AXIS) % orxJOYSTICK_AXIS_SINGLE_NUMBER) + ((ID - 1) * orxJOYSTICK_AXIS_SINGLE_NUMBER))
52 #define orxJOYSTICK_GET_BUTTON(BUTTON, ID) ((((orxU32)BUTTON) % orxJOYSTICK_BUTTON_SINGLE_NUMBER) + ((ID - 1) * orxJOYSTICK_BUTTON_SINGLE_NUMBER))
53 
54 #define orxJOYSTICK_GET_ID_FROM_AXIS(AXIS) ((((orxU32)AXIS) / orxJOYSTICK_AXIS_SINGLE_NUMBER) + 1)
55 #define orxJOYSTICK_GET_ID_FROM_BUTTON(BUTTON) ((((orxU32)BUTTON) / orxJOYSTICK_BUTTON_SINGLE_NUMBER) + 1)
56 
57 #define orxJOYSTICK_DECLARE_BUTTON_ENUM(ID) \
58  orxJOYSTICK_BUTTON_A_##ID, \
59  orxJOYSTICK_BUTTON_B_##ID, \
60  orxJOYSTICK_BUTTON_X_##ID, \
61  orxJOYSTICK_BUTTON_Y_##ID, \
62  orxJOYSTICK_BUTTON_LBUMPER_##ID, \
63  orxJOYSTICK_BUTTON_RBUMPER_##ID, \
64  orxJOYSTICK_BUTTON_BACK_##ID, \
65  orxJOYSTICK_BUTTON_START_##ID, \
66  orxJOYSTICK_BUTTON_GUIDE_##ID, \
67  orxJOYSTICK_BUTTON_LTHUMB_##ID, \
68  orxJOYSTICK_BUTTON_RTHUMB_##ID, \
69  orxJOYSTICK_BUTTON_UP_##ID, \
70  orxJOYSTICK_BUTTON_RIGHT_##ID, \
71  orxJOYSTICK_BUTTON_DOWN_##ID, \
72  orxJOYSTICK_BUTTON_LEFT_##ID, \
73  orxJOYSTICK_BUTTON_1_##ID, \
74  orxJOYSTICK_BUTTON_2_##ID, \
75  orxJOYSTICK_BUTTON_3_##ID, \
76  orxJOYSTICK_BUTTON_4_##ID, \
77  orxJOYSTICK_BUTTON_5_##ID, \
78  orxJOYSTICK_BUTTON_6_##ID, \
79  orxJOYSTICK_BUTTON_7_##ID, \
80  orxJOYSTICK_BUTTON_8_##ID, \
81  orxJOYSTICK_BUTTON_9_##ID, \
82  orxJOYSTICK_BUTTON_10_##ID, \
83  orxJOYSTICK_BUTTON_11_##ID, \
84  orxJOYSTICK_BUTTON_12_##ID, \
85  orxJOYSTICK_BUTTON_13_##ID, \
86  orxJOYSTICK_BUTTON_14_##ID, \
87  orxJOYSTICK_BUTTON_15_##ID, \
88  orxJOYSTICK_BUTTON_16_##ID, \
89  orxJOYSTICK_BUTTON_17_##ID, \
90  orxJOYSTICK_BUTTON_18_##ID, \
91  orxJOYSTICK_BUTTON_19_##ID, \
92  orxJOYSTICK_BUTTON_20_##ID, \
93  orxJOYSTICK_BUTTON_21_##ID, \
94  orxJOYSTICK_BUTTON_22_##ID, \
95  orxJOYSTICK_BUTTON_23_##ID, \
96  orxJOYSTICK_BUTTON_24_##ID, \
97  orxJOYSTICK_BUTTON_25_##ID
98 
99 #define orxJOYSTICK_DECLARE_AXIS_ENUM(ID) \
100  orxJOYSTICK_AXIS_LX_##ID, \
101  orxJOYSTICK_AXIS_LY_##ID, \
102  orxJOYSTICK_AXIS_RX_##ID, \
103  orxJOYSTICK_AXIS_RY_##ID, \
104  orxJOYSTICK_AXIS_LTRIGGER_##ID, \
105  orxJOYSTICK_AXIS_RTRIGGER_##ID
106 
109 typedef enum __orxJOYSTICK_BUTTON_t
110 {
151 
153 
194 
209 
211 
212  orxJOYSTICK_BUTTON_NONE = orxENUM_NONE
213 
215 
218 typedef enum __orxJOYSTICK_AXIS_t
219 {
226 
228 
235 
250 
252 
253  orxJOYSTICK_AXIS_NONE = orxENUM_NONE
254 
256 
257 #undef orxJOYSTICK_DECLARE_BUTTON_ENUM
258 #undef orxJOYSTICK_DECLARE_AXIS_ENUM
259 
260 #define orxJOYSTICK_KU32_MIN_ID 1
261 #define orxJOYSTICK_KU32_MAX_ID (orxJOYSTICK_BUTTON_NUMBER / orxJOYSTICK_BUTTON_SINGLE_NUMBER)
262 
263 
264 /***************************************************************************
265  * Functions directly implemented by orx core
266  ***************************************************************************/
267 
270 extern orxDLLAPI void orxFASTCALL orxJoystick_Setup();
271 
272 
273 /***************************************************************************
274  * Functions extended by plugins
275  ***************************************************************************/
276 
280 extern orxDLLAPI orxSTATUS orxFASTCALL orxJoystick_Init();
281 
284 extern orxDLLAPI void orxFASTCALL orxJoystick_Exit();
285 
290 extern orxDLLAPI orxFLOAT orxFASTCALL orxJoystick_GetAxisValue(orxJOYSTICK_AXIS _eAxis);
291 
296 extern orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsButtonPressed(orxJOYSTICK_BUTTON _eButton);
297 
302 extern orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetButtonName(orxJOYSTICK_BUTTON _eButton);
303 
308 extern orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetAxisName(orxJOYSTICK_AXIS _eAxis);
309 
314 extern orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsConnected(orxU32 _u32ID);
315 
316 #endif /* _orxJOYSTICK_H_ */
317 
orxJOYSTICK_AXIS
Definition: orxJoystick.h:218
orxDLLAPI void orxFASTCALL orxJoystick_Setup()
orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetButtonName(orxJOYSTICK_BUTTON _eButton)
orxDLLAPI void orxFASTCALL orxJoystick_Exit()
orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsConnected(orxU32 _u32ID)
orxSTATUS
Definition: orxType.h:256
orxDLLAPI orxFLOAT orxFASTCALL orxJoystick_GetAxisValue(orxJOYSTICK_AXIS _eAxis)
#define orxDLLAPI
Definition: orxDecl.h:370
orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsButtonPressed(orxJOYSTICK_BUTTON _eButton)
orxJOYSTICK_BUTTON
Definition: orxJoystick.h:109
#define orxJOYSTICK_DECLARE_AXIS_ENUM(ID)
Definition: orxJoystick.h:99
orxDLLAPI orxSTATUS orxFASTCALL orxJoystick_Init()
orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetAxisName(orxJOYSTICK_AXIS _eAxis)
#define orxJOYSTICK_DECLARE_BUTTON_ENUM(ID)
Definition: orxJoystick.h:57

Generated for orx by doxygen 1.8.11