orx  stable
Portable Game Engine
orxEvent.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2017 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 _orxEVENT_H_
43 #define _orxEVENT_H_
44 
45 #include "orxInclude.h"
46 
47 
50 #define orxEVENT_INIT(EVENT, TYPE, ID, SENDER, RECIPIENT, PAYLOAD) \
51 do \
52 { \
53  EVENT.eType = (orxEVENT_TYPE)(TYPE); \
54  EVENT.eID = (orxENUM)(ID); \
55  EVENT.hSender = (orxHANDLE)(SENDER); \
56  EVENT.hRecipient = (orxHANDLE)(RECIPIENT); \
57  EVENT.pstPayload = (void *)(PAYLOAD); \
58 } while(orxFALSE)
59 
60 #define orxEVENT_SEND(TYPE, ID, SENDER, RECIPIENT, PAYLOAD) \
61 do \
62 { \
63  orxEVENT stEvent; \
64  orxEVENT_INIT(stEvent, TYPE, ID, SENDER, RECIPIENT, PAYLOAD); \
65  orxEvent_Send(&stEvent); \
66 } while(orxFALSE)
67 
68 
71 typedef enum __orxEVENT_TYPE_t
72 {
91 
93 
95 
97 
99 
100  orxEVENT_TYPE_NONE = orxENUM_NONE,
101 
102 } orxEVENT_TYPE;
103 
106 typedef struct __orxEVENT_t
107 {
109  orxENUM eID;
110  orxHANDLE hSender;
111  orxHANDLE hRecipient;
112  void *pstPayload;
113  void *pContext;
115 } orxEVENT;
116 
117 
121 typedef orxSTATUS (orxFASTCALL *orxEVENT_HANDLER)(const orxEVENT *_pstEvent);
122 
123 
126 extern orxDLLAPI void orxFASTCALL orxEvent_Setup();
127 
131 extern orxDLLAPI orxSTATUS orxFASTCALL orxEvent_Init();
132 
135 extern orxDLLAPI void orxFASTCALL orxEvent_Exit();
136 
142 extern orxDLLAPI orxSTATUS orxFASTCALL orxEvent_AddHandler(orxEVENT_TYPE _eEventType, orxEVENT_HANDLER _pfnEventHandler);
143 
150 extern orxDLLAPI orxSTATUS orxFASTCALL orxEvent_AddHandlerWithContext(orxEVENT_TYPE _eEventType, orxEVENT_HANDLER _pfnEventHandler, void *_pContext);
151 
157 extern orxDLLAPI orxSTATUS orxFASTCALL orxEvent_RemoveHandler(orxEVENT_TYPE _eEventType, orxEVENT_HANDLER _pfnEventHandler);
158 
165 extern orxDLLAPI orxSTATUS orxFASTCALL orxEvent_RemoveHandlerWithContext(orxEVENT_TYPE _eEventType, orxEVENT_HANDLER _pfnEventHandler, void *_pContext);
166 
171 extern orxDLLAPI orxSTATUS orxFASTCALL orxEvent_Send(orxEVENT *_pstEvent);
172 
178 extern orxDLLAPI orxSTATUS orxFASTCALL orxEvent_SendShort(orxEVENT_TYPE _eEventType, orxENUM _eEventID);
179 
183 extern orxDLLAPI orxBOOL orxFASTCALL orxEvent_IsSending();
184 
185 #endif /*_orxEVENT_H_*/
186 
orxDLLAPI void orxFASTCALL orxEvent_Setup()
orxDLLAPI orxSTATUS orxFASTCALL orxEvent_RemoveHandler(orxEVENT_TYPE _eEventType, orxEVENT_HANDLER _pfnEventHandler)
void * pContext
Definition: orxEvent.h:113
orxDLLAPI orxBOOL orxFASTCALL orxEvent_IsSending()
orxDLLAPI void orxFASTCALL orxEvent_Exit()
orxDLLAPI orxSTATUS orxFASTCALL orxEvent_Send(orxEVENT *_pstEvent)
orxEVENT_TYPE eType
Definition: orxEvent.h:108
orxDLLAPI orxSTATUS orxFASTCALL orxEvent_AddHandler(orxEVENT_TYPE _eEventType, orxEVENT_HANDLER _pfnEventHandler)
orxDLLAPI orxSTATUS orxFASTCALL orxEvent_SendShort(orxEVENT_TYPE _eEventType, orxENUM _eEventID)
orxDLLAPI orxSTATUS orxFASTCALL orxEvent_RemoveHandlerWithContext(orxEVENT_TYPE _eEventType, orxEVENT_HANDLER _pfnEventHandler, void *_pContext)
orxDLLAPI orxSTATUS orxFASTCALL orxEvent_Init()
orxDLLAPI orxSTATUS orxFASTCALL orxEvent_AddHandlerWithContext(orxEVENT_TYPE _eEventType, orxEVENT_HANDLER _pfnEventHandler, void *_pContext)
orxSTATUS(orxFASTCALL * orxEVENT_HANDLER)(const orxEVENT *_pstEvent)
Definition: orxEvent.h:121
orxSTATUS
Definition: orxType.h:243
orxENUM eID
Definition: orxEvent.h:109
#define orxDLLAPI
Definition: orxDecl.h:387
orxHANDLE hRecipient
Definition: orxEvent.h:111
void * pstPayload
Definition: orxEvent.h:112
orxHANDLE hSender
Definition: orxEvent.h:110
orxEVENT_TYPE
Definition: orxEvent.h:71

Generated for orx by doxygen 1.5.6