-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEventAPI.h
45 lines (35 loc) · 1.15 KB
/
EventAPI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "xrSyncronize.h"
class ENGINE_API CEvent;
typedef CEvent* EVENT;
//---------------------------------------------------------------------
class ENGINE_API IEventReceiver
{
public:
virtual void OnEvent(EVENT E, u64 P1, u64 P2) = 0;
};
//---------------------------------------------------------------------
class ENGINE_API CEventAPI
{
struct Deferred
{
EVENT E;
u64 P1;
u64 P2;
};
private:
xr_vector<EVENT> Events;
xr_vector<Deferred> Events_Deferred;
xrCriticalSection CS;
public:
EVENT Create (const char* N);
void Destroy (EVENT& E);
EVENT Handler_Attach (const char* N, IEventReceiver* H);
void Handler_Detach (EVENT& E, IEventReceiver* H);
void Signal (EVENT E, u64 P1=0, u64 P2=0);
void Signal (LPCSTR E, u64 P1=0, u64 P2=0);
void Defer (EVENT E, u64 P1=0, u64 P2=0);
void Defer (LPCSTR E, u64 P1=0, u64 P2=0);
void OnFrame ();
void Dump ();
};