#define CRTDBG_MAP_ALLOC
//#define _CRTDBG_MAP_ALLOC
//_CRTDBG_MAP_ALLOC 경우 메모리 누수점도 나타내주나 정확하지는 않다.
#include <stdlib.h>
#include <crtdbg.h>

#include "main.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT ){

	//메모리누수 탐지 cf. _CrtDumpMemoryLeaks();
	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

	//load settings from file
	ifstream File("device.conf");
	int width, height;
	bool bWindowed;
	HWND hWnd;
	File >> width;
	File >> height;
	File >> bWindowed; //true =1, false =0
	File.close();

	WindowCore aWindowCore;
	aWindowCore.initWindow(width, height);
	hWnd = aWindowCore.makeGameWindow();
	if(!bWindowed){SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPED);}
	ShowCursor(false);

	GameCore aGameCore;
	aGameCore.initGame(hWnd, width, height, bWindowed);
	aGameCore.run();

	return S_OK;
}
