-
Notifications
You must be signed in to change notification settings - Fork 2
/
gameNode.cpp
122 lines (114 loc) · 3.25 KB
/
gameNode.cpp
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include "stdafx.h"
#include "gameNode.h"
//=============================================================
// ## 초기화 ## init()
//=============================================================
HRESULT gameNode::init()
{
_hdc = GetDC(_hWnd); //HDC 얻기
SetTimer(_hWnd, 1, 10, NULL); //타이머 초기화
INPUT->init(); //입력매니져 초기화
RANDOM->init(); //랜덤매니져 초기화
IMAGEMANAGER->init(); //이미지매니져 초기화
SCENEMANAGER->init(); //씬매니져 초기화
INIDATA->init(); //INI데이터 초기화
SOUNDMANAGER->init(); //사운드매니져 초기화
TEXTMANAGER->init(); //텍스트매니저 초기화
EFFECTMANAGER->init(); //이펙트매니저 초기화
TIME->init(); //타임매니져 초기화
DATABASE->init(); //아이템 데이터베이스 초기화
return S_OK;
}
//=============================================================
// ## 해제 ## release()
//=============================================================
void gameNode::release()
{
//타이머 해제
KillTimer(_hWnd, 1);
//입력매니져 해제
INPUT->release();
INPUT->releaseSingleton();
//랜덤매니져 해제
RANDOM->release();
RANDOM->releaseSingleton();
//이미지매니져 해제
IMAGEMANAGER->release();
IMAGEMANAGER->releaseSingleton();
//씬매니져 해제
SCENEMANAGER->release();
SCENEMANAGER->releaseSingleton();
//INI데이터 해제
INIDATA->release();
INIDATA->releaseSingleton();
//사운드매니져 해제
SOUNDMANAGER->release();
SOUNDMANAGER->releaseSingleton();
//텍스트매니저 해제
TEXTMANAGER->release();
TEXTMANAGER->releaseSingleton();
//이펙트매니저 해제
EFFECTMANAGER->release();
EFFECTMANAGER->releaseSingleton();
//카메라매니저 해제 (초기화는 맵씬에서)
CAMERA->releaseSingleton();
//타임매니져 해제
TIME->release();
TIME->releaseSingleton();
ITEMMANAGER->releaseSingleton();
STATMANAGER->release();
STATMANAGER->releaseSingleton();
ASTAR->releaseSingleton();
//HDC 해제
ReleaseDC(_hWnd, _hdc);
}
//=============================================================
// ## 업데이트 ## update()
//=============================================================
void gameNode::update()
{
//새로고침 (나중에 고성능 타이머를 만든후에는 사용하지 않는다)
//더블버퍼링 이후 사용하지 않는다 (true => false)
//InvalidateRect(_hWnd, NULL, FALSE);
}
//=============================================================
// ## 렌더 ## render()
//=============================================================
void gameNode::render()
{
}
//=============================================================
// ## 메인프로시져 ## MainProc()
//=============================================================
LRESULT gameNode::MainProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_TIMER:
this->update();
break;
case WM_PAINT:
this->render();
break;
case WM_MOUSEMOVE:
_ptMouse.x = LOWORD(lParam);
_ptMouse.y = HIWORD(lParam);
_ptMouse.x = _ptMouse.x < 0 ? 0 : _ptMouse.x;
_ptMouse.x = _ptMouse.x > WINSIZEX ? WINSIZEX : _ptMouse.x;
_ptMouse.y = _ptMouse.y < 0 ? 0 : _ptMouse.y;
_ptMouse.y = _ptMouse.y > WINSIZEY ? WINSIZEY : _ptMouse.y;
break;
case WM_KEYDOWN:
//switch (wParam)
//{
//case VK_ESCAPE:
// PostMessage(hWnd, WM_DESTROY, 0, 0);
// break;
//}
break;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return (DefWindowProc(hWnd, message, wParam, lParam));
}