// Dark GDK - The Game Creators - www.thegamecreators.com

/*	==========================================================================
	Project:		Alliance
	Created:		December 13, 2014
	Version:		1.0.0
	Copyright:		© 2014 WickedX Software. All rights reserved.
	Programmed By:	Brian Delano - WickedX Software
	Description:	Dark GDK Game
	===========================================================================	*/

// ***** Start Main Source *****

// include the applications header file
#include "Alliance.h"

// the main entry point for the application is this function
void DarkGDK()
{
	// initialize and load level
	Initialize();
	LoadLevel("level1");

	// position camera and set orientation
	dbPositionCamera(16128.0f, dbGetTerrainGroundHeight(TERID, 16128.0f, -16128.0f), -16128.0f);
	dbRotateCamera(0.0f, 0.0f, 0.0f);

	// set directional light
	dbSetDirectionalLight(0, -0.768221f, -0.640184f, 0.0f);

	// set foreground color
	g_pGlob->dwForeColor = 0xFF000000;

	// our main loop
	while (LoopGDK())
	{
		// draw debug info
		dbSetCursor(0, 0);
		dbPrintC("FPS: "); dbPrint((LONGLONG)dbScreenFPS());
		dbPrint();
		dbPrintC("Camera Position X: "); dbPrint(dbCameraPositionX());
		dbPrintC("Camera Position Y: "); dbPrint(dbCameraPositionY());
		dbPrintC("Camera Position Z: "); dbPrint(dbCameraPositionZ());
		dbPrint();
		dbPrintC("Camera Angle X: "); dbPrint(dbCameraAngleX());
		dbPrintC("Camera Angle Y: "); dbPrint(dbCameraAngleY());
		dbPrintC("Camera Angle Z: "); dbPrint(dbCameraAngleZ());

		// keyboard control
		KeyControl();

		// update terrain
		dbUpdateTerrain();

		// update the screen
		dbSync();

		if (dbEscapeKey())
			break;
	}

	// clean up
	dbEnableEscapeKey();
	dbShowMouse();

	// return back to windows
	return;
}