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

#include "base/main.h"

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

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

	LayerInfo aLayerInfo;

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

	WindowBase aWindowBase(&aLayerInfo);
	//I dont set anything, so just constructed with default setting
	aWindowBase.newWindow();

	GameBase aGameBase(&aLayerInfo);
	aGameBase.newGameDevice();

	GameCore aGameCore(&aLayerInfo);
	aGameCore.run();

	aGameBase.deleteGameDevice();
	aWindowBase.deleteWindow();
	return S_OK;
}
