-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.cpp
41 lines (34 loc) · 1.37 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
#include <Windows.h>
#include "Game.h"
// --------------------------------------------------------
// Entry point for a graphical (non-console) Windows application
// --------------------------------------------------------
int WINAPI WinMain(
_In_ HINSTANCE hInstance, // The handle to this app's instance
_In_opt_ HINSTANCE hPrevInstance, // A handle to the previous instance of the app (always NULL)
_In_ LPSTR lpCmdLine, // Command line params
_In_ int nCmdShow) // How the window should be shown (we ignore this)
{
#if defined(DEBUG) | defined(_DEBUG)
// Enable memory leak detection as a quick and dirty
// way of determining if we forgot to clean something up
// - You may want to use something more advanced, like Visual Leak Detector
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
// Create the Game object using
// the app handle we got from WinMain
Game dxGame(hInstance);
// Result variable for function calls below
HRESULT hr = S_OK;
// Attempt to create the window for our program, and
// exit early if something failed
hr = dxGame.InitWindow();
if(FAILED(hr)) return hr;
// Attempt to initialize DirectX, and exit
// early if something failed
hr = dxGame.InitDirectX();
if(FAILED(hr)) return hr;
// Begin the message and game loop, and then return
// whatever we get back once the game loop is over
return dxGame.Run();
}