-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
50 lines (43 loc) · 923 Bytes
/
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
#if defined(_DEBUG)
#include <stdlib.h>
#include <crtdbg.h>
#endif
#include "GameWindow.h"
#ifdef _DEBUG
#include <iostream>
static int reportHook(int reportType, char* userMessage, int* ) {
if (reportType == _CRT_ASSERT) {
std::cout << userMessage << std::endl;
return TRUE;
}
return FALSE;
}
#endif // DEBUG
int WINAPI WinMain(_In_ HINSTANCE , _In_opt_ HINSTANCE , _In_ PSTR , _In_ int )
{
#if defined(_DEBUG)
int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
_CrtSetDbgFlag(tmpFlag);
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
_CrtSetReportHook(&reportHook);
#endif
HRESULT hr = CoInitializeEx(nullptr, COINITBASE_MULTITHREADED);
if (FAILED(hr))
{
return false;
}
GameWindow game;
if (game.Initialize())
{
while (game.IsRunning())
{
game.Broadcast();
}
}
CoUninitialize();
#if defined(_DEBUG)
_CrtDumpMemoryLeaks();
#endif
return 0;
}