Torque3D/Templates/BaseGame/game/main.cs.in
Areloch 1ed8b05169 Initial implementation of the new Base Game Template and some starting modules.
This makes some tweaks to the engine to support this, specifically, it tweaks the hardcoded shaderpaths to defer to a pref variable, so none of the shader paths are hardcoded.

Also tweaks how post effects read in texture files, removing a bizzare filepath interpretation choice, where if the file path didn't start with "/" it forcefully appended the script's file path. This made it impossible to have images not in the same dir as the script file defining the post effect.

This was changed and the existing template's post effects tweaked for now to just add "./" to those few paths impacted, as well as the perf vars to support the non-hardcoded shader paths in the engine.
2017-02-24 02:40:56 -06:00

93 lines
No EOL
2.4 KiB
C#

$Core::windowIcon = "data/icon.png";
$Core::splashWindowImage = "data/splash.png";
// Display a splash window immediately to improve app responsiveness before
// engine is initialized and main window created.
displaySplashWindow($Core::splashWindowImage);
// Console does something.
setLogMode(6);
// Disable script trace.
trace(false);
// Set the name of our application
$appName = "@TORQUE_APP_NAME@";
//-----------------------------------------------------------------------------
// Load up scripts to initialise subsystems.
exec("core/main.cs");
// Parse the command line arguments
echo("\n--------- Parsing Arguments ---------");
parseArgs();
// The canvas needs to be initialized before any gui scripts are run since
// some of the controls assume that the canvas exists at load time.
createCanvas($appName);
//-----------------------------------------------------------------------------
// Load console.
exec("core/console/main.cs");
// Init the physics plugin.
physicsInit();
sfxStartup();
// Set up networking.
setNetPort(0);
// Start processing file change events.
startFileChangeNotifications();
// If we have editors, initialize them here as well
if(isFile("tools/main.cs") && !$isDedicated)
exec("tools/main.cs");
ModuleDatabase.setModuleExtension("module");
ModuleDatabase.scanModules( "data", false );
ModuleDatabase.LoadGroup( "Game" );
if( !$isDedicated )
{
// Start rendering and stuff.
initRenderManager();
initLightingSystems("Advanced Lighting");
//load prefs
%prefPath = getPrefpath();
if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
exec( %prefPath @ "/clientPrefs.cs" );
else
exec("data/defaults.cs");
configureCanvas();
//Autodetect settings if it's our first time
if($pref::Video::autoDetect)
GraphicsMenu.Autodetect();
closeSplashWindow();
// As we know at this point that the initial load is complete,
// we can hide any splash screen we have, and show the canvas.
// This keeps things looking nice, instead of having a blank window
Canvas.showWindow();
}
else
{
closeSplashWindow();
}
echo("Engine initialized...");
//-----------------------------------------------------------------------------
// Called when the engine is shutting down.
function onExit()
{
// Stop file change events.
stopFileChangeNotifications();
ModuleDatabase.UnloadExplicit( "Game" );
}