//---------------------------------------------------------------------------------------------
// Torque Game Builder
// Copyright (C) GarageGames.com, Inc.
//---------------------------------------------------------------------------------------------


/// Player Initialization Procedure
/// 
function onStart()
{   
	%res = getDesktopResolution();
	$desktopWidth=getWord(%res,0);
	$desktopHeight=getWord(%res,1);
	$bpp=getWord(%res,2);
	
	$displayNameGuiXY=0.625*$desktopWidth @ " " @ 0.05859375*$desktopHeight;
	$fontSize=mFloor(($desktopWidth/1280)*36);
	$GuiMLTextProfileFontSize=mFloor(($desktopWidth/1280)*26);
	$GuiListBoxProfileFontSize=mFloor(($desktopWidth/1280)*26);
	$GuiTextEditProfileFontSize=mFloor(($desktopWidth/1280)*30);
	$namesListXY=mFloor(0.4375*$desktopWidth) @ " " @ mFloor(0.33203125*$desktopHeight);

	$okButton1XY=mFloor(0.4140625*$desktopWidth) @ " " @ mFloor(0.6865234375*$desktopHeight);
	$newButton1XY=mFloor(0.4140625*$desktopWidth) @ " " @ mFloor(0.6376953125*$desktopHeight);
	$cancelButton1XY=mFloor(0.5*$desktopWidth) @ " " @ mFloor(0.6865234375*$desktopHeight);
	$deleteButton1XY=mFloor(0.5*$desktopWidth) @ " " @ mFloor(0.6376953125*$desktopHeight);

	$buttonsSize=mFloor(0.084375*$desktopWidth) @ " " @ mFloor(0.041015625*$desktopHeight);

	$okButtonXY=mFloor(0.40625*$desktopWidth) @ " " @ mFloor(0.5322265625*$desktopHeight);
	$cancelButtonXY=mFloor(0.5078125*$desktopWidth) @ " " @ mFloor(0.5322265625*$desktopHeight);
	$playersNameTextXY=mFloor(0.3828125*$desktopWidth) @ " " @ mFloor(0.478515625*$desktopHeight);
	$enterYourNameXY=mFloor(0.41796875*$desktopWidth) @ " " @ mFloor(0.4296875*$desktopHeight);

	$playersNameTextSize=mFloor(0.234375*$desktopWidth) @ " " @ mFloor(0.048828125*$desktopHeight);
	$enterYourNameSize=mFloor(0.234375*$desktopWidth) @ " " @ mFloor(0.0390625*$desktopHeight);

	$dialogTextXY=mFloor(0.41796875*$desktopWidth) @ " " @ mFloor(0.4296875*$desktopHeight);
	$dialogTextSize=mFloor(0.3046875*$desktopWidth) @ " " @ mFloor(0.29296875*$desktopHeight);
}

function onExit()
{
}

//---------------------------------------------------------------------------------------------
// Load the paths we need access to
//---------------------------------------------------------------------------------------------
function loadPath( %path )
{
   setModPaths( getModPaths() @ ";" @ %path );
   exec(%path @ "/main.cs");

}

//---------------------------------------------
// Do some bootstrap voodoo to get the game to 
// the initializeProject phase of loading and 
// pass off to the user
//---------------------------------------------

// Output a console log
setLogMode(6);

loadPath( "common" );

loadPath( "game" );

onStart();

// Initialized
echo("\nTorque Game Builder (" @ getT2DVersion() @ ") initialized...");

if( !isFunction( "initializeProject" ) || !isFunction( "_initializeProject" ) )
{
   messageBox( "Game Startup Error", "'initializeProject' function could not be found." @
               "\nThis could indicate a bad or corrupt common directory for your game." @
               "\n\nThe Game will now shutdown because it cannot properly function", "Ok", "MIStop" );
   quit();
}

_initializeProject();

// Startup the project
initializeProject();


