-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameFramework.cpp
66 lines (51 loc) · 1008 Bytes
/
GameFramework.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
#include "stdafx.h"
#include "GameFramework.h"
WGameFramework::WGameFramework()
{
}
WGameFramework::~WGameFramework()
{
}
void WGameFramework::Reset()
{
}
void WGameFramework::Clear()
{
//프로그램 끝낼 때 현재 씬도 delete 해주기
scene* scene = curScene;
delete scene;
}
void WGameFramework::Create(HWND hWnd)
{
m_hWnd = hWnd;
curScene = new menuScene; //처음에는 게임 시작 화면으로
nowscene = MENU;
curScene->init();
}
void WGameFramework::OnDraw(HDC hdc)
{
curScene->Render(hdc);
}
void WGameFramework::OnUpdate(const float frameTime)
{
curScene->Update(frameTime);
//여기서 현재 씬 업데이트
}
void WGameFramework::KeyBoard(UINT iMessage, WPARAM wParam, LPARAM lParam)
{
switch (iMessage)
{
case WM_KEYDOWN:
{
if (wParam == VK_Q) {
SendMessage(m_hWnd, WM_DESTROY, 0, 0); //Q 누르면 종료
return;
}
}
}
curScene->processKey(iMessage, wParam, lParam); //현재 씬의 프로세스키
}
float WGameFramework::GetTick()
{
return (float)(curFrameTime - prevFrameTime) / 1000;
}