-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
70 lines (43 loc) · 1.9 KB
/
main.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
//--------------------------------------------------------------------------------------
// DirectX 11 Starting Template Created by Stefan Petersson (BTH) 2014
// Project Coded by Daniel Fredriksson & Oliver Glandberger.
//--------------------------------------------------------------------------------------
// APPLICATION
#include "ApplicationClass.hpp"
// FOR MEMORY LEAKS
#include <crtdbg.h>
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
CoInitialize(NULL); // "Initialize COM Library", needed for 'CreateWICTextureFromFile'
bool ActiveHoverCam = false;
ApplicationClass *Application;
Application = new ApplicationClass;
Application->Initialize(hInstance); // Initialize classes
Application->SetMainBackBufferRTV(); // Uses LightShader's BackBufferRT
Application->SetObjectData(); // Load object data to classes
Application->CreateQuadTree(); // Requires ObjectData to be set
Application->SetHeightMapData(); // Load the height map
ShowWindow(Application->GetWNDHandle(), nCmdShow);
while (Application->GetInputMessage()->message != WM_QUIT)
{
if (PeekMessage(Application->GetInputMessage(), nullptr, 0, 0, PM_REMOVE))
{
TranslateMessage(Application->GetInputMessage()); // Calls WindowProcedure in some part of its internal process
DispatchMessage(Application->GetInputMessage());
// Windows procedure exists in application.cpp below "non-class functions"
}
else
{
Application->FrustumCull();
Application->getTimer()->Update();
Application->RenderShadowMap(); // Create the ShadowMap Texture2D
Application->RenderDeferredAll(); // Requires FrustumCull to be called.
Application->RenderParticles();
Application->Present();
}
}
Application->Shutdown();
delete Application;
return (int)(*Application->GetInputMessage()).wParam;
}