orx 1.16
Portable Game Engine
Loading...
Searching...
No Matches
orxJoystick.h
Go to the documentation of this file.
1/* Orx - Portable Game Engine
2 *
3 * Copyright (c) 2008- 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
32
41
42
43#ifndef _orxJOYSTICK_H_
44#define _orxJOYSTICK_H_
45
46#include "orxInclude.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
109typedef enum __orxJOYSTICK_BUTTON_t
110{
151
153
194
209
211
213
215
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
270extern orxDLLAPI void orxFASTCALL orxJoystick_Setup();
271
272
273/***************************************************************************
274 * Functions extended by plugins
275 ***************************************************************************/
276
281
284extern orxDLLAPI void orxFASTCALL orxJoystick_Exit();
285
290extern orxDLLAPI orxFLOAT orxFASTCALL orxJoystick_GetAxisValue(orxJOYSTICK_AXIS _eAxis);
291
296extern orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsButtonPressed(orxJOYSTICK_BUTTON _eButton);
297
302extern orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetButtonName(orxJOYSTICK_BUTTON _eButton);
303
308extern orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetAxisName(orxJOYSTICK_AXIS _eAxis);
309
314extern orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsConnected(orxU32 _u32ID);
315
316#endif /* _orxJOYSTICK_H_ */
317
#define orxDLLAPI
Definition orxDecl.h:381
#define orxJOYSTICK_DECLARE_BUTTON_ENUM(ID)
Definition orxJoystick.h:57
orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetAxisName(orxJOYSTICK_AXIS _eAxis)
orxDLLAPI orxSTATUS orxFASTCALL orxJoystick_Init()
orxDLLAPI void orxFASTCALL orxJoystick_Setup()
orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsButtonPressed(orxJOYSTICK_BUTTON _eButton)
orxDLLAPI void orxFASTCALL orxJoystick_Exit()
orxDLLAPI const orxSTRING orxFASTCALL orxJoystick_GetButtonName(orxJOYSTICK_BUTTON _eButton)
orxJOYSTICK_AXIS
orxDLLAPI orxFLOAT orxFASTCALL orxJoystick_GetAxisValue(orxJOYSTICK_AXIS _eAxis)
orxJOYSTICK_BUTTON
#define orxJOYSTICK_DECLARE_AXIS_ENUM(ID)
Definition orxJoystick.h:99
orxDLLAPI orxBOOL orxFASTCALL orxJoystick_IsConnected(orxU32 _u32ID)
@ orxJOYSTICK_AXIS_RY_2
@ orxJOYSTICK_AXIS_RTRIGGER_1
@ orxJOYSTICK_AXIS_LX_1
@ orxJOYSTICK_AXIS_RX_2
@ orxJOYSTICK_AXIS_NONE
@ orxJOYSTICK_AXIS_LTRIGGER_1
@ orxJOYSTICK_AXIS_SINGLE_NUMBER
@ orxJOYSTICK_AXIS_LX_2
@ orxJOYSTICK_AXIS_RX_1
@ orxJOYSTICK_AXIS_RTRIGGER_2
@ orxJOYSTICK_AXIS_LY_2
@ orxJOYSTICK_AXIS_RY_1
@ orxJOYSTICK_AXIS_NUMBER
@ orxJOYSTICK_AXIS_LTRIGGER_2
@ orxJOYSTICK_AXIS_LY_1
@ orxJOYSTICK_BUTTON_12_1
@ orxJOYSTICK_BUTTON_DOWN_1
@ orxJOYSTICK_BUTTON_19_2
@ orxJOYSTICK_BUTTON_10_1
@ orxJOYSTICK_BUTTON_1_2
@ orxJOYSTICK_BUTTON_BACK_2
@ orxJOYSTICK_BUTTON_22_2
@ orxJOYSTICK_BUTTON_6_1
@ orxJOYSTICK_BUTTON_24_1
@ orxJOYSTICK_BUTTON_11_1
@ orxJOYSTICK_BUTTON_25_2
@ orxJOYSTICK_BUTTON_21_1
@ orxJOYSTICK_BUTTON_RIGHT_2
@ orxJOYSTICK_BUTTON_LBUMPER_2
@ orxJOYSTICK_BUTTON_RBUMPER_1
@ orxJOYSTICK_BUTTON_22_1
@ orxJOYSTICK_BUTTON_SINGLE_NUMBER
@ orxJOYSTICK_BUTTON_NONE
@ orxJOYSTICK_BUTTON_4_1
@ orxJOYSTICK_BUTTON_14_2
@ orxJOYSTICK_BUTTON_13_2
@ orxJOYSTICK_BUTTON_X_2
@ orxJOYSTICK_BUTTON_GUIDE_2
@ orxJOYSTICK_BUTTON_1_1
@ orxJOYSTICK_BUTTON_8_1
@ orxJOYSTICK_BUTTON_4_2
@ orxJOYSTICK_BUTTON_5_2
@ orxJOYSTICK_BUTTON_24_2
@ orxJOYSTICK_BUTTON_9_1
@ orxJOYSTICK_BUTTON_19_1
@ orxJOYSTICK_BUTTON_14_1
@ orxJOYSTICK_BUTTON_UP_2
@ orxJOYSTICK_BUTTON_DOWN_2
@ orxJOYSTICK_BUTTON_NUMBER
@ orxJOYSTICK_BUTTON_Y_1
@ orxJOYSTICK_BUTTON_A_2
@ orxJOYSTICK_BUTTON_START_1
@ orxJOYSTICK_BUTTON_7_2
@ orxJOYSTICK_BUTTON_23_2
@ orxJOYSTICK_BUTTON_18_2
@ orxJOYSTICK_BUTTON_Y_2
@ orxJOYSTICK_BUTTON_2_1
@ orxJOYSTICK_BUTTON_B_1
@ orxJOYSTICK_BUTTON_17_2
@ orxJOYSTICK_BUTTON_LTHUMB_1
@ orxJOYSTICK_BUTTON_12_2
@ orxJOYSTICK_BUTTON_18_1
@ orxJOYSTICK_BUTTON_21_2
@ orxJOYSTICK_BUTTON_RBUMPER_2
@ orxJOYSTICK_BUTTON_B_2
@ orxJOYSTICK_BUTTON_3_1
@ orxJOYSTICK_BUTTON_START_2
@ orxJOYSTICK_BUTTON_X_1
@ orxJOYSTICK_BUTTON_16_2
@ orxJOYSTICK_BUTTON_7_1
@ orxJOYSTICK_BUTTON_LEFT_1
@ orxJOYSTICK_BUTTON_17_1
@ orxJOYSTICK_BUTTON_A_1
@ orxJOYSTICK_BUTTON_10_2
@ orxJOYSTICK_BUTTON_LBUMPER_1
@ orxJOYSTICK_BUTTON_2_2
@ orxJOYSTICK_BUTTON_8_2
@ orxJOYSTICK_BUTTON_9_2
@ orxJOYSTICK_BUTTON_LTHUMB_2
@ orxJOYSTICK_BUTTON_16_1
@ orxJOYSTICK_BUTTON_RIGHT_1
@ orxJOYSTICK_BUTTON_3_2
@ orxJOYSTICK_BUTTON_BACK_1
@ orxJOYSTICK_BUTTON_23_1
@ orxJOYSTICK_BUTTON_20_2
@ orxJOYSTICK_BUTTON_GUIDE_1
@ orxJOYSTICK_BUTTON_13_1
@ orxJOYSTICK_BUTTON_5_1
@ orxJOYSTICK_BUTTON_25_1
@ orxJOYSTICK_BUTTON_LEFT_2
@ orxJOYSTICK_BUTTON_15_1
@ orxJOYSTICK_BUTTON_RTHUMB_2
@ orxJOYSTICK_BUTTON_UP_1
@ orxJOYSTICK_BUTTON_15_2
@ orxJOYSTICK_BUTTON_20_1
@ orxJOYSTICK_BUTTON_RTHUMB_1
@ orxJOYSTICK_BUTTON_11_2
@ orxJOYSTICK_BUTTON_6_2
orxSTATUS
Definition orxType.h:270

Generated for orx by doxygen 1.8.11