orx  1.14
Portable Game Engine
orxInput.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 _orxINPUT_H_
44 #define _orxINPUT_H_
45 
46 
47 #include "orxInclude.h"
48 
49 #include "io/orxJoystick.h"
50 #include "io/orxKeyboard.h"
51 #include "io/orxMouse.h"
52 
53 
56 #define orxINPUT_KZ_CONFIG_SECTION "Input"
57 #define orxINPUT_KZ_CONFIG_DEFAULT_THRESHOLD "DefaultThreshold"
58 #define orxINPUT_KZ_CONFIG_DEFAULT_MULTIPLIER "DefaultMultiplier"
59 #define orxINPUT_KZ_CONFIG_COMBINE_LIST "CombineList"
60 #define orxINPUT_KZ_CONFIG_JOYSTICK_ID_LIST "JoyIDList"
62 #define orxINPUT_KU32_BINDING_NUMBER 16
63 
64 #define orxINPUT_KZ_INTERNAL_SET_PREFIX "-="
65 
66 #define orxINPUT_KC_MODE_PREFIX_POSITIVE '+'
67 #define orxINPUT_KC_MODE_PREFIX_NEGATIVE '-'
68 
69 #define orxINPUT_GET_FLAG(TYPE) ((orxU32)(1U << (orxU32)(TYPE)))
70 #define orxINPUT_KU32_FLAG_TYPE_NONE 0x00000000
71 #define orxINPUT_KU32_MASK_TYPE_ALL 0x0000FFFF
72 
73 
76 typedef enum __orxINPUT_TYPE_t
77 {
84 
86 
87  orxINPUT_TYPE_NONE = orxENUM_NONE
88 
90 
93 typedef enum __orxINPUT_MODE_t
94 {
98 
100 
101  orxINPUT_MODE_NONE = orxENUM_NONE
102 
103 } orxINPUT_MODE;
104 
107 typedef enum __orxINPUT_EVENT_t
108 {
113 
115 
116  orxINPUT_EVENT_NONE = orxENUM_NONE
117 
119 
122 typedef struct __orxINPUT_EVENT_PAYLOAD_t
123 {
124  const orxSTRING zSetName;
125  const orxSTRING zInputName;
129  orxFLOAT afValue[orxINPUT_KU32_BINDING_NUMBER];
132 
133 
136 extern orxDLLAPI void orxFASTCALL orxInput_Setup();
137 
141 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_Init();
142 
145 extern orxDLLAPI void orxFASTCALL orxInput_Exit();
146 
147 
152 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_Load(const orxSTRING _zFileName);
153 
158 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_Save(const orxSTRING _zFileName);
159 
160 
165 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_SelectSet(const orxSTRING _zSetName);
166 
170 extern orxDLLAPI const orxSTRING orxFASTCALL orxInput_GetCurrentSet();
171 
176 extern orxDLLAPI const orxSTRING orxFASTCALL orxInput_GetNextSet(const orxSTRING _zSetName);
177 
182 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_RemoveSet(const orxSTRING _zSetName);
183 
184 
190 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_EnableSet(const orxSTRING _zSetName, orxBOOL _bEnable);
191 
196 extern orxDLLAPI orxBOOL orxFASTCALL orxInput_IsSetEnabled(const orxSTRING _zSetName);
197 
198 
204 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetTypeFlags(orxU32 _u32AddTypeFlags, orxU32 _u32RemoveTypeFlags);
205 
206 
211 extern orxDLLAPI orxBOOL orxFASTCALL orxInput_IsActive(const orxSTRING _zInputName);
212 
217 extern orxDLLAPI orxBOOL orxFASTCALL orxInput_HasBeenActivated(const orxSTRING _zInputName);
218 
223 extern orxDLLAPI orxBOOL orxFASTCALL orxInput_HasBeenDeactivated(const orxSTRING _zInputName);
224 
229 extern orxDLLAPI orxBOOL orxFASTCALL orxInput_HasNewStatus(const orxSTRING _zInputName);
230 
235 extern orxDLLAPI orxFLOAT orxFASTCALL orxInput_GetValue(const orxSTRING _zInputName);
236 
242 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetValue(const orxSTRING _zInputName, orxFLOAT _fValue);
243 
249 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetPermanentValue(const orxSTRING _zInputName, orxFLOAT _fValue);
250 
255 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_ResetValue(const orxSTRING _zInputName);
256 
257 
262 extern orxDLLAPI orxFLOAT orxFASTCALL orxInput_GetThreshold(const orxSTRING _zInputName);
263 
269 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetThreshold(const orxSTRING _zInputName, orxFLOAT _fThreshold);
270 
275 extern orxDLLAPI orxFLOAT orxFASTCALL orxInput_GetMultiplier(const orxSTRING _zInputName);
276 
282 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetMultiplier(const orxSTRING _zInputName, orxFLOAT _fMultiplier);
283 
284 
290 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetCombineMode(const orxSTRING _zName, orxBOOL _bCombine);
291 
296 extern orxDLLAPI orxBOOL orxFASTCALL orxInput_IsInCombineMode(const orxSTRING _zName);
297 
298 
307 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_Bind(const orxSTRING _zName, orxINPUT_TYPE _eType, orxENUM _eID, orxINPUT_MODE _eMode, orxS32 _s32BindingIndex);
308 
314 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_Unbind(const orxSTRING _zName, orxS32 _s32BindingIndex);
315 
322 extern orxDLLAPI orxU32 orxFASTCALL orxInput_GetBoundInputCount(orxINPUT_TYPE _eType, orxENUM _eID, orxINPUT_MODE _eMode);
323 
333 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetBoundInput(orxINPUT_TYPE _eType, orxENUM _eID, orxINPUT_MODE _eMode, orxU32 _u32InputIndex, const orxSTRING *_pzName, orxU32 *_pu32BindingIndex);
334 
343 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetBinding(const orxSTRING _zName, orxU32 _u32BindingIndex, orxINPUT_TYPE *_peType, orxENUM *_peID, orxINPUT_MODE *_peMode);
344 
352 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetBindingList(const orxSTRING _zName, orxINPUT_TYPE _aeTypeList[orxINPUT_KU32_BINDING_NUMBER], orxENUM _aeIDList[orxINPUT_KU32_BINDING_NUMBER], orxINPUT_MODE _aeModeList[orxINPUT_KU32_BINDING_NUMBER]);
353 
354 
361 extern orxDLLAPI const orxSTRING orxFASTCALL orxInput_GetBindingName(orxINPUT_TYPE _eType, orxENUM _eID, orxINPUT_MODE _eMode);
362 
370 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetBindingType(const orxSTRING _zName, orxINPUT_TYPE *_peType, orxENUM *_peID, orxINPUT_MODE *_peMode);
371 
378 extern orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetActiveBinding(orxINPUT_TYPE *_peType, orxENUM *_peID, orxFLOAT *_pfValue);
379 
380 #endif /*_orxINPUT_H_*/
381 
orxDLLAPI orxU32 orxFASTCALL orxInput_GetBoundInputCount(orxINPUT_TYPE _eType, orxENUM _eID, orxINPUT_MODE _eMode)
orxDLLAPI orxBOOL orxFASTCALL orxInput_HasBeenActivated(const orxSTRING _zInputName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_SelectSet(const orxSTRING _zSetName)
orxINPUT_EVENT
Definition: orxInput.h:107
orxDLLAPI orxSTATUS orxFASTCALL orxInput_RemoveSet(const orxSTRING _zSetName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_Save(const orxSTRING _zFileName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_ResetValue(const orxSTRING _zInputName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_Unbind(const orxSTRING _zName, orxS32 _s32BindingIndex)
orxDLLAPI orxFLOAT orxFASTCALL orxInput_GetThreshold(const orxSTRING _zInputName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetPermanentValue(const orxSTRING _zInputName, orxFLOAT _fValue)
orxINPUT_MODE
Definition: orxInput.h:93
orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetBindingList(const orxSTRING _zName, orxINPUT_TYPE _aeTypeList[orxINPUT_KU32_BINDING_NUMBER], orxENUM _aeIDList[orxINPUT_KU32_BINDING_NUMBER], orxINPUT_MODE _aeModeList[orxINPUT_KU32_BINDING_NUMBER])
orxDLLAPI const orxSTRING orxFASTCALL orxInput_GetBindingName(orxINPUT_TYPE _eType, orxENUM _eID, orxINPUT_MODE _eMode)
orxDLLAPI orxBOOL orxFASTCALL orxInput_IsActive(const orxSTRING _zInputName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetActiveBinding(orxINPUT_TYPE *_peType, orxENUM *_peID, orxFLOAT *_pfValue)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetThreshold(const orxSTRING _zInputName, orxFLOAT _fThreshold)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_Bind(const orxSTRING _zName, orxINPUT_TYPE _eType, orxENUM _eID, orxINPUT_MODE _eMode, orxS32 _s32BindingIndex)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetBindingType(const orxSTRING _zName, orxINPUT_TYPE *_peType, orxENUM *_peID, orxINPUT_MODE *_peMode)
orxSTATUS
Definition: orxType.h:256
orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetValue(const orxSTRING _zInputName, orxFLOAT _fValue)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetCombineMode(const orxSTRING _zName, orxBOOL _bCombine)
orxDLLAPI orxBOOL orxFASTCALL orxInput_IsInCombineMode(const orxSTRING _zName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_Load(const orxSTRING _zFileName)
orxDLLAPI void orxFASTCALL orxInput_Exit()
const orxSTRING zSetName
Definition: orxInput.h:124
#define orxDLLAPI
Definition: orxDecl.h:370
orxDLLAPI orxFLOAT orxFASTCALL orxInput_GetValue(const orxSTRING _zInputName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetBinding(const orxSTRING _zName, orxU32 _u32BindingIndex, orxINPUT_TYPE *_peType, orxENUM *_peID, orxINPUT_MODE *_peMode)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetTypeFlags(orxU32 _u32AddTypeFlags, orxU32 _u32RemoveTypeFlags)
const orxSTRING zInputName
Definition: orxInput.h:125
orxDLLAPI void orxFASTCALL orxInput_Setup()
orxINPUT_TYPE
Definition: orxInput.h:76
orxDLLAPI orxBOOL orxFASTCALL orxInput_HasNewStatus(const orxSTRING _zInputName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_EnableSet(const orxSTRING _zSetName, orxBOOL _bEnable)
orxDLLAPI orxFLOAT orxFASTCALL orxInput_GetMultiplier(const orxSTRING _zInputName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_GetBoundInput(orxINPUT_TYPE _eType, orxENUM _eID, orxINPUT_MODE _eMode, orxU32 _u32InputIndex, const orxSTRING *_pzName, orxU32 *_pu32BindingIndex)
#define orxINPUT_KU32_BINDING_NUMBER
Definition: orxInput.h:62
orxDLLAPI orxSTATUS orxFASTCALL orxInput_Init()
orxDLLAPI orxBOOL orxFASTCALL orxInput_HasBeenDeactivated(const orxSTRING _zInputName)
orxDLLAPI orxSTATUS orxFASTCALL orxInput_SetMultiplier(const orxSTRING _zInputName, orxFLOAT _fMultiplier)
orxDLLAPI const orxSTRING orxFASTCALL orxInput_GetNextSet(const orxSTRING _zSetName)
orxDLLAPI orxBOOL orxFASTCALL orxInput_IsSetEnabled(const orxSTRING _zSetName)
orxDLLAPI const orxSTRING orxFASTCALL orxInput_GetCurrentSet()

Generated for orx by doxygen 1.8.11