#include "stdafx.h"
#include "CellWarsGameManager.h"

#include <Windows.h>

int main(int argc, char* argv[])
{
	// Will be overwritten by thePrefs from bits/config/default.lua
	int windowWidth			= 1920;
	int windowHeight		= 1080;
	std::string windowName(Game_Name);
	bool antiAliasing		= true;
	bool fullScreen			= true;
	bool resizable			= true;

	bool firstTryResult = theWorld.Initialize(windowWidth, windowHeight, windowName, antiAliasing, fullScreen, resizable);
	bool fallbackResult = false;

	if (!firstTryResult){
		fallbackResult = theWorld.Initialize(800, 600, Game_Name, true, false, false);
	}

	if (firstTryResult || fallbackResult){
		
		float SIZE_OF_AREA_IN_ANGEL_UNITS = 30;
		theCamera.SetZByViewRadius(SIZE_OF_AREA_IN_ANGEL_UNITS * 0.5f);

		//adds the default grid so you can more easily place Actors
#ifdef _DEBUG
		theWorld.Add(new GridActor(), -1);
#endif

		theWorld.SetGameManager(&theCellWarsGame);
		
		SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
		theWorld.StartGame();
	}
	
	theWorld.Destroy();
	
	return 0;
}
