/*	Copyright (C) 2016 Richard W. Allen
Program Name:  TrooperEngineTest
Author:        Richard W. Allen
Version:       V1.0
Date Started:  August 24, 2016
Date End:
Webpage:       http://www.richardallenonline.com
IDE:           Visual Studio 2017
Compiler:      C\C++ 2017
Langage:       C++
License:       GNU GENERAL PUBLIC LICENSE Version 2
see license.txt for details

*/

/*** TrooperEngine DLL Header Files ***/
#include "TrooperEngine.hpp"

/*** SDL Header Files ***/
#include "SDL.h"

/*** Unit Testing ***/
#include "UTest/UTest.hpp"

/*** Video Engine Test ***/
#include "VideoEngineTest/VideoEngineTest.hpp"

/*** Utility Engine Test ***/
#include "UtilityEngineTest/UtilityEngineTest.hpp"

/*** Math Engine Test ***/
#include "MathEngineTest/MathEngineTest.hpp"

/*** GUI Engine Test ***/
#include "GUIEngineTest/GUIXMLTest.hpp"

#include <string>

using UtilityEngine::cString;

void CleanUp() 
{
	TrooperEngineCore::cTrooperEngineCore::Delete();
}

int main(int argc, char *argv[])
{
	argc, argv;

	printf(cString("TrooperEngine V") + TrooperEngineCore::cTrooperEngineCore::Version() + "\n");
		
	VideoEngineTest();

	UtilityEngineTest();		

	MathEngineTest();

	GUIXMLTest();
	SDL_Rect rec = { 0, 0, 100, 20 };

	//ImageTest();
	
	UTest::OverAllReport();
	SDL_Event event;
	bool run = true;
	while (run) {
		VideoEngine::cVideo::Inst().Display();
		//EventEngine::cEventControl::Inst().CheckEvents();
		while (SDL_PollEvent(&event)) {
			/* We are only worried about SDL_KEYDOWN and SDL_KEYUP events */
			switch (event.type) {
			case SDL_KEYDOWN:
				switch (event.key.keysym.sym) {
				case SDLK_SPACE:
					run = false;
					break;
				case SDLK_RETURN:
					VideoEngine::cVideo::Inst().ScreenShot("test.bmp");
				default:
					break;
				}
				break;

			case SDL_KEYUP:
				printf("Key release detected\n");
				break;

			default:
				break;
			}
		}
	}

	CleanUp();

	return 0;
}