-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCGameCtrl.h
58 lines (46 loc) · 1.03 KB
/
CGameCtrl.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef CGAMECTRL_H_
#define CGAMECTRL_H_
#include <Windows.h>
#define DECLARE() static CGameCtrl* CreateObject();
#define IMPLEMENT(ThisClass) \
CGameCtrl* ThisClass::CreateObject()\
{\
return new ThisClass;\
}\
Init init##ThisClass(&ThisClass::CreateObject);
class CGameCtrl;
typedef CGameCtrl* (*PFUN_CREATE_OBJECT)();
class CGameCtrl
{
public:
CGameCtrl() {}
virtual ~CGameCtrl() {}
public:
void SetHandel(HWND hWnd, HINSTANCE hIns)
{
this->m_hMainWnd = hWnd;
this->m_hIns = hIns;
}
static PFUN_CREATE_OBJECT pfun_create_object;
protected:
HWND m_hMainWnd;
HINSTANCE m_hIns;
public:
virtual void OnCreateGame() {}
virtual void OnGameDraw() {}
virtual void OnGameRun(WPARAM nTimerID) {}
virtual void OnKeyDown(WPARAM nKey) {}
virtual void OnKeyUp(WPARAM nKey) {}
virtual void OnLButtonDown(POINT point) {}
virtual void OnLButtonUp(POINT point) {}
virtual void OnMouseMove(POINT point) {}
};
class Init
{
public:
Init(PFUN_CREATE_OBJECT pfn)
{
CGameCtrl::pfun_create_object = pfn;
}
};
#endif // !CGAMECTRL_H_