-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLights.cpp
More file actions
100 lines (82 loc) · 2.36 KB
/
Copy pathLights.cpp
File metadata and controls
100 lines (82 loc) · 2.36 KB
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
#include "stdafx.h"
void MainGame()
{
//Update
SceneManager::GetInstance()->CheckChangeScene();
KeyManager::GetInstance()->Update();
Time::GetInstance()->Update();
SceneManager::GetInstance()->GetNowScene()->SceneUpdate(Time::GetInstance()->fDeltaTime);
CDirect3D::GetInstance()->Render();
SceneManager::GetInstance()->GetNowScene()->SceneIO();
}
VOID Cleanup()
{
//Remove
SceneManager::GetInstance()->RemoveAll();
BitmapManager::GetInstance()->RemoveAll();
CDirect3D::GetInstance()->Cleanup();
}
LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch (msg)
{
case WM_MOUSEMOVE:
KeyManager::GetInstance()->SetMousePos(LOWORD(lParam), HIWORD(lParam));
return 0;
case WM_KEYDOWN:
if(wParam == VK_ESCAPE)
PostQuitMessage(0);
return 0;
case WM_DESTROY:
Cleanup();
PostQuitMessage(0);
return 0;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT )
{
UNREFERENCED_PARAMETER( hInst );
// Register the window class
WNDCLASSEX wc =
{
sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
"D3D Tutorial", NULL
};
RegisterClassEx( &wc );
//SetCursor(LoadCursor(NULL, IDC_ARROW));
SetCursor(NULL);
ShowCursor(FALSE);
// Create the application's window
HWND hWnd = CreateWindow( "D3D Tutorial", "2D Game 101",
WS_POPUP|WS_EX_TOPMOST, 0, 0, CDirect3D::GetInstance()->dScnX, CDirect3D::GetInstance()->dScnY,
NULL, NULL, wc.hInstance, NULL );
//WS_OVERLAPPEDWINDOW
// Initialize Direct3D
if (SUCCEEDED(CDirect3D::GetInstance()->InitD3D(hWnd)))
{
//SceneManager::GetInstance()->AddScene("SceneMenu", new SceneMenu);
//SceneManager::GetInstance()->ChangeScene("SceneMenu", true);
SceneManager::GetInstance()->AddScene("Opening", new Opening);
SceneManager::GetInstance()->ChangeScene("Opening", true);
// Show the window
ShowWindow(hWnd, SW_SHOWDEFAULT);
UpdateWindow(hWnd);
// Enter the message loop
MSG msg;
ZeroMemory(&msg, sizeof(msg));
while (msg.message != WM_QUIT)
{
if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
MainGame();
}
}
UnregisterClass( "D3D Tutorial", wc.hInstance );
return 0;
}