orx  1.10
Portable Game Engine
orxJoystick.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2019 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 
49 
52 #define orxJOYSTICK_GET_AXIS(AXIS, ID) ((((orxU32)AXIS) % orxJOYSTICK_AXIS_SINGLE_NUMBER) + ((ID - 1) * orxJOYSTICK_AXIS_SINGLE_NUMBER))
53 #define orxJOYSTICK_GET_BUTTON(BUTTON, ID) ((((orxU32)BUTTON) % orxJOYSTICK_BUTTON_SINGLE_NUMBER) + ((ID - 1) * orxJOYSTICK_BUTTON_SINGLE_NUMBER))
54 
55 #define orxJOYSTICK_GET_ID_FROM_AXIS(AXIS) ((((orxU32)AXIS) / orxJOYSTICK_AXIS_SINGLE_NUMBER) + 1)
56 #define orxJOYSTICK_GET_ID_FROM_BUTTON(BUTTON) ((((orxU32)BUTTON) / orxJOYSTICK_BUTTON_SINGLE_NUMBER) + 1)
57 
58 #define orxJOYSTICK_DECLARE_BUTTON_ENUM(ID) \
59  orxJOYSTICK_BUTTON_A_##ID, \
60  orxJOYSTICK_BUTTON_B_##ID, \
61  orxJOYSTICK_BUTTON_X_##ID, \
62  orxJOYSTICK_BUTTON_Y_##ID, \
63  orxJOYSTICK_BUTTON_LBUMPER_##ID, \
64  orxJOYSTICK_BUTTON_RBUMPER_##ID, \
65  orxJOYSTICK_BUTTON_BACK_##ID, \
66  orxJOYSTICK_BUTTON_START_##ID, \
67  orxJOYSTICK_BUTTON_GUIDE_##ID, \
68  orxJOYSTICK_BUTTON_LTHUMB_##ID, \
69  orxJOYSTICK_BUTTON_RTHUMB_##ID, \
70  orxJOYSTICK_BUTTON_UP_##ID, \
71  orxJOYSTICK_BUTTON_RIGHT_##ID, \
72  orxJOYSTICK_BUTTON_DOWN_##ID, \
73  orxJOYSTICK_BUTTON_LEFT_##ID, \
74  orxJOYSTICK_BUTTON_1_##ID, \
75  orxJOYSTICK_BUTTON_2_##ID, \
76  orxJOYSTICK_BUTTON_3_##ID, \
77  orxJOYSTICK_BUTTON_4_##ID, \
78  orxJOYSTICK_BUTTON_5_##ID, \
79  orxJOYSTICK_BUTTON_6_##ID, \
80  orxJOYSTICK_BUTTON_7_##ID, \
81  orxJOYSTICK_BUTTON_8_##ID, \
82  orxJOYSTICK_BUTTON_9_##ID, \
83  orxJOYSTICK_BUTTON_10_##ID, \
84  orxJOYSTICK_BUTTON_11_##ID, \
85  orxJOYSTICK_BUTTON_12_##ID, \
86  orxJOYSTICK_BUTTON_13_##ID, \
87  orxJOYSTICK_BUTTON_14_##ID, \
88  orxJOYSTICK_BUTTON_15_##ID, \
89  orxJOYSTICK_BUTTON_16_##ID
90 
91 #define orxJOYSTICK_DECLARE_AXIS_ENUM(ID) \
92  orxJOYSTICK_AXIS_LX_##ID, \
93  orxJOYSTICK_AXIS_LY_##ID, \
94  orxJOYSTICK_AXIS_RX_##ID, \
95  orxJOYSTICK_AXIS_RY_##ID, \
96  orxJOYSTICK_AXIS_LTRIGGER_##ID, \
97  orxJOYSTICK_AXIS_RTRIGGER_##ID
98 
101 typedef enum __orxJOYSTICK_BUTTON_t
102 {
134 
136 
168 
183 
185 
186  orxJOYSTICK_BUTTON_NONE = orxENUM_NONE
187 
189 
192 typedef enum __orxJOYSTICK_AXIS_t
193 {
200 
202 
209 
224 
226 
227  orxJOYSTICK_AXIS_NONE = orxENUM_NONE
228 
230 
231 #undef orxJOYSTICK_DECLARE_BUTTON_ENUM
232 #undef orxJOYSTICK_DECLARE_AXIS_ENUM
233 
234 
235 /***************************************************************************
236  * Functions directly implemented by orx core
237  ***************************************************************************/
238 
241 extern orxDLLAPI void orxFASTCALL orxJoystick_Setup();
242 
243 
244 /***************************************************************************
245  * Functions extended by plugins
246  ***************************************************************************/
247 
251 extern orxDLLAPI orxSTATUS orxFASTCALL orxJoystick_Init();
252 
255 extern orxDLLAPI void orxFASTCALL orxJoystick_Exit();
256 
261 extern orxDLLAPI orxFLOAT orxFASTCALL orxJoystick_GetAxisValue(orxJOYSTICK_AXIS _eAxis);
262 
267 extern orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsButtonPressed(orxJOYSTICK_BUTTON _eButton);
268 
273 extern orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetButtonName(orxJOYSTICK_BUTTON _eButton);
274 
279 extern orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetAxisName(orxJOYSTICK_AXIS _eAxis);
280 
285 extern orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsConnected(orxU32 _u32ID);
286 
287 #endif /* _orxJOYSTICK_H_ */
288 
orxJOYSTICK_AXIS
Definition: orxJoystick.h:192
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:246
orxDLLAPI orxFLOAT orxFASTCALL orxJoystick_GetAxisValue(orxJOYSTICK_AXIS _eAxis)
#define orxDLLAPI
Definition: orxDecl.h:381
orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsButtonPressed(orxJOYSTICK_BUTTON _eButton)
orxJOYSTICK_BUTTON
Definition: orxJoystick.h:101
#define orxJOYSTICK_DECLARE_AXIS_ENUM(ID)
Definition: orxJoystick.h:91
orxDLLAPI orxSTATUS orxFASTCALL orxJoystick_Init()
orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetAxisName(orxJOYSTICK_AXIS _eAxis)
#define orxJOYSTICK_DECLARE_BUTTON_ENUM(ID)
Definition: orxJoystick.h:58

Generated for orx by doxygen 1.8.11