orx  1.14
Portable Game Engine
orxClock.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 
42 #ifndef _orxCLOCK_H_
43 #define _orxCLOCK_H_
44 
45 
46 #include "orxInclude.h"
47 #include "core/orxSystem.h"
48 #include "utils/orxString.h"
49 
50 
51 #define orxCLOCK_KU32_CLOCK_BANK_SIZE 16
52 #define orxCLOCK_KU32_TIMER_BANK_SIZE 32
54 #define orxCLOCK_KU32_FUNCTION_BANK_SIZE 16
56 #define orxCLOCK_KZ_CONFIG_FREQUENCY "Frequency"
57 #define orxCLOCK_KZ_CONFIG_MODIFIER_LIST "ModifierList"
58 
59 #define orxCLOCK_KZ_CORE "core"
60 
61 
64 typedef enum __orxCLOCK_MODIFIER_t
65 {
72 
73  orxCLOCK_MODIFIER_NONE = orxENUM_NONE,
74 
76 
77 
80 typedef enum __orxCLOCK_PRIORITY_t
81 {
89 
91 
92  orxCLOCK_PRIORITY_NONE = orxENUM_NONE,
93 
95 
96 
99 typedef struct __orxCLOCK_INFO_t
100 {
101  orxFLOAT fTickSize;
102  orxFLOAT fDT;
103  orxFLOAT fTime;
104  orxFLOAT afModifierList[orxCLOCK_MODIFIER_NUMBER];
106 } orxCLOCK_INFO;
107 
108 
111 typedef enum __orxCLOCK_EVENT_t
112 {
119 
120  orxCLOCK_EVENT_NONE = orxENUM_NONE
121 
123 
124 
126 typedef struct __orxCLOCK_t orxCLOCK;
127 
129 typedef void (orxFASTCALL *orxCLOCK_FUNCTION)(const orxCLOCK_INFO *_pstClockInfo, void *_pContext);
130 
131 
134 extern orxDLLAPI void orxFASTCALL orxClock_Setup();
135 
139 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Init();
140 
143 extern orxDLLAPI void orxFASTCALL orxClock_Exit();
144 
145 
149 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Update();
150 
155 extern orxDLLAPI orxCLOCK *orxFASTCALL orxClock_Create(orxFLOAT _fTickSize);
156 
161 extern orxDLLAPI orxCLOCK *orxFASTCALL orxClock_CreateFromConfig(const orxSTRING _zConfigID);
162 
167 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Delete(orxCLOCK *_pstClock);
168 
172 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Resync(orxCLOCK *_pstClock);
173 
177 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_ResyncAll();
178 
183 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Restart(orxCLOCK *_pstClock);
184 
189 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Pause(orxCLOCK *_pstClock);
190 
195 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Unpause(orxCLOCK *_pstClock);
196 
201 extern orxDLLAPI orxBOOL orxFASTCALL orxClock_IsPaused(const orxCLOCK *_pstClock);
202 
207 extern orxDLLAPI const orxCLOCK_INFO *orxFASTCALL orxClock_GetInfo(const orxCLOCK *_pstClock);
208 
213 extern orxDLLAPI orxCLOCK *orxFASTCALL orxClock_GetFromInfo(const orxCLOCK_INFO *_pstClockInfo);
214 
215 
222 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_SetModifier(orxCLOCK *_pstClock, orxCLOCK_MODIFIER _eModifier, orxFLOAT _fValue);
223 
229 extern orxDLLAPI orxFLOAT orxFASTCALL orxClock_GetModifier(orxCLOCK *_pstClock, orxCLOCK_MODIFIER _eModifier);
230 
236 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_SetTickSize(orxCLOCK *_pstClock, orxFLOAT _fTickSize);
237 
238 
247 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Register(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback, void *_pContext, orxMODULE_ID _eModuleID, orxCLOCK_PRIORITY _ePriority);
248 
254 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_Unregister(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback);
255 
261 extern orxDLLAPI void *orxFASTCALL orxClock_GetContext(const orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback);
262 
269 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_SetContext(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback, void *_pContext);
270 
271 
276 extern orxDLLAPI orxCLOCK *orxFASTCALL orxClock_GetNext(const orxCLOCK *_pstClock);
277 
282 extern orxDLLAPI orxCLOCK *orxFASTCALL orxClock_Get(const orxSTRING _zName);
283 
288 extern orxDLLAPI const orxSTRING orxFASTCALL orxClock_GetName(const orxCLOCK *_pstClock);
289 
290 
299 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_AddTimer(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback, orxFLOAT _fDelay, orxS32 _s32Repetition, void *_pContext);
300 
308 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_RemoveTimer(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback, orxFLOAT _fDelay, void *_pContext);
309 
317 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_AddGlobalTimer(const orxCLOCK_FUNCTION _pfnCallback, orxFLOAT _fDelay, orxS32 _s32Repetition, void *_pContext);
318 
325 extern orxDLLAPI orxSTATUS orxFASTCALL orxClock_RemoveGlobalTimer(const orxCLOCK_FUNCTION _pfnCallback, orxFLOAT _fDelay, void *_pContext);
326 
327 
328 #endif /* _orxCLOCK_H_ */
329 
orxDLLAPI void orxFASTCALL orxClock_Exit()
orxDLLAPI orxSTATUS orxFASTCALL orxClock_SetModifier(orxCLOCK *_pstClock, orxCLOCK_MODIFIER _eModifier, orxFLOAT _fValue)
orxFLOAT fTickSize
Definition: orxClock.h:101
orxCLOCK_PRIORITY
Definition: orxClock.h:80
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Delete(orxCLOCK *_pstClock)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Update()
orxDLLAPI orxSTATUS orxFASTCALL orxClock_RemoveGlobalTimer(const orxCLOCK_FUNCTION _pfnCallback, orxFLOAT _fDelay, void *_pContext)
orxMODULE_ID
Definition: orxModule.h:53
struct __orxCLOCK_t orxCLOCK
Definition: orxClock.h:126
orxDLLAPI orxCLOCK *orxFASTCALL orxClock_Get(const orxSTRING _zName)
orxDLLAPI const orxCLOCK_INFO *orxFASTCALL orxClock_GetInfo(const orxCLOCK *_pstClock)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_ResyncAll()
orxCLOCK_MODIFIER
Definition: orxClock.h:64
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Resync(orxCLOCK *_pstClock)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_SetContext(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback, void *_pContext)
void(orxFASTCALL * orxCLOCK_FUNCTION)(const orxCLOCK_INFO *_pstClockInfo, void *_pContext)
Definition: orxClock.h:129
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Register(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback, void *_pContext, orxMODULE_ID _eModuleID, orxCLOCK_PRIORITY _ePriority)
orxDLLAPI orxCLOCK *orxFASTCALL orxClock_GetNext(const orxCLOCK *_pstClock)
orxDLLAPI void orxFASTCALL orxClock_Setup()
orxDLLAPI const orxSTRING orxFASTCALL orxClock_GetName(const orxCLOCK *_pstClock)
orxSTATUS
Definition: orxType.h:256
orxDLLAPI orxFLOAT orxFASTCALL orxClock_GetModifier(orxCLOCK *_pstClock, orxCLOCK_MODIFIER _eModifier)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_RemoveTimer(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback, orxFLOAT _fDelay, void *_pContext)
typedef void(orxFASTCALL *orxMODULE_EXIT_FUNCTION)()
#define orxDLLAPI
Definition: orxDecl.h:370
orxDLLAPI orxSTATUS orxFASTCALL orxClock_AddTimer(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback, orxFLOAT _fDelay, orxS32 _s32Repetition, void *_pContext)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_AddGlobalTimer(const orxCLOCK_FUNCTION _pfnCallback, orxFLOAT _fDelay, orxS32 _s32Repetition, void *_pContext)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Pause(orxCLOCK *_pstClock)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Unregister(orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Restart(orxCLOCK *_pstClock)
orxFLOAT fDT
Definition: orxClock.h:102
orxDLLAPI orxCLOCK *orxFASTCALL orxClock_Create(orxFLOAT _fTickSize)
orxDLLAPI orxCLOCK *orxFASTCALL orxClock_GetFromInfo(const orxCLOCK_INFO *_pstClockInfo)
orxDLLAPI orxBOOL orxFASTCALL orxClock_IsPaused(const orxCLOCK *_pstClock)
orxDLLAPI orxCLOCK *orxFASTCALL orxClock_CreateFromConfig(const orxSTRING _zConfigID)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_SetTickSize(orxCLOCK *_pstClock, orxFLOAT _fTickSize)
orxFLOAT fTime
Definition: orxClock.h:103
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Unpause(orxCLOCK *_pstClock)
orxDLLAPI orxSTATUS orxFASTCALL orxClock_Init()
orxCLOCK_EVENT
Definition: orxClock.h:111
orxDLLAPI void *orxFASTCALL orxClock_GetContext(const orxCLOCK *_pstClock, const orxCLOCK_FUNCTION _pfnCallback)

Generated for orx by doxygen 1.8.11