mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
main.cs configuring now (optional), fixed installation up, fixed application name up, fixed executable name, added configured torsion template
This commit is contained in:
parent
cd727f7711
commit
f3dbe07b9a
5 changed files with 614 additions and 20 deletions
280
Templates/Empty/game/main.cs.in
Normal file
280
Templates/Empty/game/main.cs.in
Normal file
|
|
@ -0,0 +1,280 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Set the name of our application
|
||||||
|
$appName = "@TORQUE_APP_NAME@";
|
||||||
|
|
||||||
|
// The directory it is run from
|
||||||
|
$defaultGame = "scripts";
|
||||||
|
|
||||||
|
// Set profile directory
|
||||||
|
$Pref::Video::ProfilePath = "core/profile";
|
||||||
|
|
||||||
|
function createCanvas(%windowTitle)
|
||||||
|
{
|
||||||
|
if ($isDedicated)
|
||||||
|
{
|
||||||
|
GFXInit::createNullDevice();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the Canvas
|
||||||
|
%foo = new GuiCanvas(Canvas);
|
||||||
|
|
||||||
|
// Set the window title
|
||||||
|
if (isObject(Canvas))
|
||||||
|
Canvas.setWindowTitle(getEngineName() @ " - " @ $appName);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display the optional commandline arguements
|
||||||
|
$displayHelp = false;
|
||||||
|
|
||||||
|
// Use these to record and play back crashes
|
||||||
|
//saveJournal("editorOnFileQuitCrash.jrn");
|
||||||
|
//playJournal("editorOnFileQuitCrash.jrn", false);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Check if a script file exists, compiled or not.
|
||||||
|
function isScriptFile(%path)
|
||||||
|
{
|
||||||
|
if( isFile(%path @ ".dso") || isFile(%path) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Process command line arguments
|
||||||
|
exec("core/parseArgs.cs");
|
||||||
|
|
||||||
|
$isDedicated = false;
|
||||||
|
$dirCount = 2;
|
||||||
|
$userDirs = $defaultGame @ ";art;levels";
|
||||||
|
|
||||||
|
// load tools scripts if we're a tool build
|
||||||
|
if (isToolBuild())
|
||||||
|
$userDirs = "tools;" @ $userDirs;
|
||||||
|
|
||||||
|
|
||||||
|
// Parse the executable arguments with the standard
|
||||||
|
// function from core/main.cs
|
||||||
|
defaultParseArgs();
|
||||||
|
|
||||||
|
|
||||||
|
if($dirCount == 0) {
|
||||||
|
$userDirs = $defaultGame;
|
||||||
|
$dirCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Display a splash window immediately to improve app responsiveness before
|
||||||
|
// engine is initialized and main window created
|
||||||
|
if (!$isDedicated)
|
||||||
|
displaySplashWindow();
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// The displayHelp, onStart, onExit and parseArgs function are overriden
|
||||||
|
// by mod packages to get hooked into initialization and cleanup.
|
||||||
|
|
||||||
|
function onStart()
|
||||||
|
{
|
||||||
|
// Default startup function
|
||||||
|
}
|
||||||
|
|
||||||
|
function onExit()
|
||||||
|
{
|
||||||
|
// OnExit is called directly from C++ code, whereas onStart is
|
||||||
|
// invoked at the end of this file.
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseArgs()
|
||||||
|
{
|
||||||
|
// Here for mod override, the arguments have already
|
||||||
|
// been parsed.
|
||||||
|
}
|
||||||
|
|
||||||
|
function compileFiles(%pattern)
|
||||||
|
{
|
||||||
|
%path = filePath(%pattern);
|
||||||
|
|
||||||
|
%saveDSO = $Scripts::OverrideDSOPath;
|
||||||
|
%saveIgnore = $Scripts::ignoreDSOs;
|
||||||
|
|
||||||
|
$Scripts::OverrideDSOPath = %path;
|
||||||
|
$Scripts::ignoreDSOs = false;
|
||||||
|
%mainCsFile = makeFullPath("main.cs");
|
||||||
|
|
||||||
|
for (%file = findFirstFileMultiExpr(%pattern); %file !$= ""; %file = findNextFileMultiExpr(%pattern))
|
||||||
|
{
|
||||||
|
// we don't want to try and compile the primary main.cs
|
||||||
|
if(%mainCsFile !$= %file)
|
||||||
|
compile(%file, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$Scripts::OverrideDSOPath = %saveDSO;
|
||||||
|
$Scripts::ignoreDSOs = %saveIgnore;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($compileAll)
|
||||||
|
{
|
||||||
|
echo(" --- Compiling all files ---");
|
||||||
|
compileFiles("*.cs");
|
||||||
|
compileFiles("*.gui");
|
||||||
|
compileFiles("*.ts");
|
||||||
|
echo(" --- Exiting after compile ---");
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($compileTools)
|
||||||
|
{
|
||||||
|
echo(" --- Compiling tools scritps ---");
|
||||||
|
compileFiles("tools/*.cs");
|
||||||
|
compileFiles("tools/*.gui");
|
||||||
|
compileFiles("tools/*.ts");
|
||||||
|
echo(" --- Exiting after compile ---");
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
package Help {
|
||||||
|
function onExit() {
|
||||||
|
// Override onExit when displaying help
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function displayHelp() {
|
||||||
|
activatePackage(Help);
|
||||||
|
|
||||||
|
// Notes on logmode: console logging is written to console.log.
|
||||||
|
// -log 0 disables console logging.
|
||||||
|
// -log 1 appends to existing logfile; it also closes the file
|
||||||
|
// (flushing the write buffer) after every write.
|
||||||
|
// -log 2 overwrites any existing logfile; it also only closes
|
||||||
|
// the logfile when the application shuts down. (default)
|
||||||
|
|
||||||
|
error(
|
||||||
|
"Torque Demo command line options:\n"@
|
||||||
|
" -log <logmode> Logging behavior; see main.cs comments for details\n"@
|
||||||
|
" -game <game_name> Reset list of mods to only contain <game_name>\n"@
|
||||||
|
" <game_name> Works like the -game argument\n"@
|
||||||
|
" -dir <dir_name> Add <dir_name> to list of directories\n"@
|
||||||
|
" -console Open a separate console\n"@
|
||||||
|
" -show <shape> Deprecated\n"@
|
||||||
|
" -jSave <file_name> Record a journal\n"@
|
||||||
|
" -jPlay <file_name> Play back a journal\n"@
|
||||||
|
" -jDebug <file_name> Play back a journal and issue an int3 at the end\n"@
|
||||||
|
" -help Display this help message\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Default to a new logfile each session.
|
||||||
|
if( !$logModeSpecified )
|
||||||
|
{
|
||||||
|
if( $platform !$= "xbox" && $platform !$= "xenon" )
|
||||||
|
setLogMode(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the first dir on the list, which will be the last to be applied... this
|
||||||
|
// does not modify the list.
|
||||||
|
nextToken($userDirs, currentMod, ";");
|
||||||
|
|
||||||
|
// Execute startup scripts for each mod, starting at base and working up
|
||||||
|
function loadDir(%dir)
|
||||||
|
{
|
||||||
|
pushback($userDirs, %dir, ";");
|
||||||
|
|
||||||
|
if (isScriptFile(%dir @ "/main.cs"))
|
||||||
|
exec(%dir @ "/main.cs");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo("--------- Loading DIRS ---------");
|
||||||
|
function loadDirs(%dirPath)
|
||||||
|
{
|
||||||
|
%dirPath = nextToken(%dirPath, token, ";");
|
||||||
|
if (%dirPath !$= "")
|
||||||
|
loadDirs(%dirPath);
|
||||||
|
|
||||||
|
if(exec(%token @ "/main.cs") != true)
|
||||||
|
{
|
||||||
|
error("Error: Unable to find specified directory: " @ %token );
|
||||||
|
$dirCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loadDirs($userDirs);
|
||||||
|
echo("");
|
||||||
|
|
||||||
|
if($dirCount == 0) {
|
||||||
|
enableWinConsole(true);
|
||||||
|
error("Error: Unable to load any specified directories");
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
// Parse the command line arguments
|
||||||
|
echo("--------- Parsing Arguments ---------");
|
||||||
|
parseArgs();
|
||||||
|
|
||||||
|
// Either display the help message or startup the app.
|
||||||
|
if ($displayHelp) {
|
||||||
|
enableWinConsole(true);
|
||||||
|
displayHelp();
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
onStart();
|
||||||
|
echo("Engine initialized...");
|
||||||
|
|
||||||
|
// Auto-load on the 360
|
||||||
|
if( $platform $= "xenon" )
|
||||||
|
{
|
||||||
|
%mission = "levels/Empty Terrain.mis";
|
||||||
|
|
||||||
|
echo("Xbox360 Autoloading level: '" @ %mission @ "'");
|
||||||
|
|
||||||
|
|
||||||
|
if ($pref::HostMultiPlayer)
|
||||||
|
%serverType = "MultiPlayer";
|
||||||
|
else
|
||||||
|
%serverType = "SinglePlayer";
|
||||||
|
|
||||||
|
createAndConnectToLocalServer( %serverType, %mission );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display an error message for unused arguments
|
||||||
|
for ($i = 1; $i < $Game::argc; $i++) {
|
||||||
|
if (!$argUsed[$i])
|
||||||
|
error("Error: Unknown command line argument: " @ $Game::argv[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically start up the appropriate eidtor, if any
|
||||||
|
if ($startWorldEditor) {
|
||||||
|
Canvas.setCursor("DefaultCursor");
|
||||||
|
Canvas.setContent(EditorChooseLevelGui);
|
||||||
|
} else if ($startGUIEditor) {
|
||||||
|
Canvas.setCursor("DefaultCursor");
|
||||||
|
Canvas.setContent(EditorChooseGUI);
|
||||||
|
}
|
||||||
280
Templates/Full/game/main.cs.in
Normal file
280
Templates/Full/game/main.cs.in
Normal file
|
|
@ -0,0 +1,280 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Set the name of our application
|
||||||
|
$appName = "@TORQUE_APP_NAME@";
|
||||||
|
|
||||||
|
// The directory it is run from
|
||||||
|
$defaultGame = "scripts";
|
||||||
|
|
||||||
|
// Set profile directory
|
||||||
|
$Pref::Video::ProfilePath = "core/profile";
|
||||||
|
|
||||||
|
function createCanvas(%windowTitle)
|
||||||
|
{
|
||||||
|
if ($isDedicated)
|
||||||
|
{
|
||||||
|
GFXInit::createNullDevice();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the Canvas
|
||||||
|
%foo = new GuiCanvas(Canvas);
|
||||||
|
|
||||||
|
// Set the window title
|
||||||
|
if (isObject(Canvas))
|
||||||
|
Canvas.setWindowTitle(getEngineName() @ " - " @ $appName);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display the optional commandline arguements
|
||||||
|
$displayHelp = false;
|
||||||
|
|
||||||
|
// Use these to record and play back crashes
|
||||||
|
//saveJournal("editorOnFileQuitCrash.jrn");
|
||||||
|
//playJournal("editorOnFileQuitCrash.jrn", false);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Check if a script file exists, compiled or not.
|
||||||
|
function isScriptFile(%path)
|
||||||
|
{
|
||||||
|
if( isFile(%path @ ".dso") || isFile(%path) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Process command line arguments
|
||||||
|
exec("core/parseArgs.cs");
|
||||||
|
|
||||||
|
$isDedicated = false;
|
||||||
|
$dirCount = 2;
|
||||||
|
$userDirs = $defaultGame @ ";art;levels";
|
||||||
|
|
||||||
|
// load tools scripts if we're a tool build
|
||||||
|
if (isToolBuild())
|
||||||
|
$userDirs = "tools;" @ $userDirs;
|
||||||
|
|
||||||
|
|
||||||
|
// Parse the executable arguments with the standard
|
||||||
|
// function from core/main.cs
|
||||||
|
defaultParseArgs();
|
||||||
|
|
||||||
|
|
||||||
|
if($dirCount == 0) {
|
||||||
|
$userDirs = $defaultGame;
|
||||||
|
$dirCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Display a splash window immediately to improve app responsiveness before
|
||||||
|
// engine is initialized and main window created
|
||||||
|
if (!$isDedicated)
|
||||||
|
displaySplashWindow();
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// The displayHelp, onStart, onExit and parseArgs function are overriden
|
||||||
|
// by mod packages to get hooked into initialization and cleanup.
|
||||||
|
|
||||||
|
function onStart()
|
||||||
|
{
|
||||||
|
// Default startup function
|
||||||
|
}
|
||||||
|
|
||||||
|
function onExit()
|
||||||
|
{
|
||||||
|
// OnExit is called directly from C++ code, whereas onStart is
|
||||||
|
// invoked at the end of this file.
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseArgs()
|
||||||
|
{
|
||||||
|
// Here for mod override, the arguments have already
|
||||||
|
// been parsed.
|
||||||
|
}
|
||||||
|
|
||||||
|
function compileFiles(%pattern)
|
||||||
|
{
|
||||||
|
%path = filePath(%pattern);
|
||||||
|
|
||||||
|
%saveDSO = $Scripts::OverrideDSOPath;
|
||||||
|
%saveIgnore = $Scripts::ignoreDSOs;
|
||||||
|
|
||||||
|
$Scripts::OverrideDSOPath = %path;
|
||||||
|
$Scripts::ignoreDSOs = false;
|
||||||
|
%mainCsFile = makeFullPath("main.cs");
|
||||||
|
|
||||||
|
for (%file = findFirstFileMultiExpr(%pattern); %file !$= ""; %file = findNextFileMultiExpr(%pattern))
|
||||||
|
{
|
||||||
|
// we don't want to try and compile the primary main.cs
|
||||||
|
if(%mainCsFile !$= %file)
|
||||||
|
compile(%file, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$Scripts::OverrideDSOPath = %saveDSO;
|
||||||
|
$Scripts::ignoreDSOs = %saveIgnore;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($compileAll)
|
||||||
|
{
|
||||||
|
echo(" --- Compiling all files ---");
|
||||||
|
compileFiles("*.cs");
|
||||||
|
compileFiles("*.gui");
|
||||||
|
compileFiles("*.ts");
|
||||||
|
echo(" --- Exiting after compile ---");
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($compileTools)
|
||||||
|
{
|
||||||
|
echo(" --- Compiling tools scritps ---");
|
||||||
|
compileFiles("tools/*.cs");
|
||||||
|
compileFiles("tools/*.gui");
|
||||||
|
compileFiles("tools/*.ts");
|
||||||
|
echo(" --- Exiting after compile ---");
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
package Help {
|
||||||
|
function onExit() {
|
||||||
|
// Override onExit when displaying help
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function displayHelp() {
|
||||||
|
activatePackage(Help);
|
||||||
|
|
||||||
|
// Notes on logmode: console logging is written to console.log.
|
||||||
|
// -log 0 disables console logging.
|
||||||
|
// -log 1 appends to existing logfile; it also closes the file
|
||||||
|
// (flushing the write buffer) after every write.
|
||||||
|
// -log 2 overwrites any existing logfile; it also only closes
|
||||||
|
// the logfile when the application shuts down. (default)
|
||||||
|
|
||||||
|
error(
|
||||||
|
"Torque Demo command line options:\n"@
|
||||||
|
" -log <logmode> Logging behavior; see main.cs comments for details\n"@
|
||||||
|
" -game <game_name> Reset list of mods to only contain <game_name>\n"@
|
||||||
|
" <game_name> Works like the -game argument\n"@
|
||||||
|
" -dir <dir_name> Add <dir_name> to list of directories\n"@
|
||||||
|
" -console Open a separate console\n"@
|
||||||
|
" -show <shape> Deprecated\n"@
|
||||||
|
" -jSave <file_name> Record a journal\n"@
|
||||||
|
" -jPlay <file_name> Play back a journal\n"@
|
||||||
|
" -jDebug <file_name> Play back a journal and issue an int3 at the end\n"@
|
||||||
|
" -help Display this help message\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Default to a new logfile each session.
|
||||||
|
if( !$logModeSpecified )
|
||||||
|
{
|
||||||
|
if( $platform !$= "xbox" && $platform !$= "xenon" )
|
||||||
|
setLogMode(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the first dir on the list, which will be the last to be applied... this
|
||||||
|
// does not modify the list.
|
||||||
|
nextToken($userDirs, currentMod, ";");
|
||||||
|
|
||||||
|
// Execute startup scripts for each mod, starting at base and working up
|
||||||
|
function loadDir(%dir)
|
||||||
|
{
|
||||||
|
pushback($userDirs, %dir, ";");
|
||||||
|
|
||||||
|
if (isScriptFile(%dir @ "/main.cs"))
|
||||||
|
exec(%dir @ "/main.cs");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo("--------- Loading DIRS ---------");
|
||||||
|
function loadDirs(%dirPath)
|
||||||
|
{
|
||||||
|
%dirPath = nextToken(%dirPath, token, ";");
|
||||||
|
if (%dirPath !$= "")
|
||||||
|
loadDirs(%dirPath);
|
||||||
|
|
||||||
|
if(exec(%token @ "/main.cs") != true)
|
||||||
|
{
|
||||||
|
error("Error: Unable to find specified directory: " @ %token );
|
||||||
|
$dirCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loadDirs($userDirs);
|
||||||
|
echo("");
|
||||||
|
|
||||||
|
if($dirCount == 0) {
|
||||||
|
enableWinConsole(true);
|
||||||
|
error("Error: Unable to load any specified directories");
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
// Parse the command line arguments
|
||||||
|
echo("--------- Parsing Arguments ---------");
|
||||||
|
parseArgs();
|
||||||
|
|
||||||
|
// Either display the help message or startup the app.
|
||||||
|
if ($displayHelp) {
|
||||||
|
enableWinConsole(true);
|
||||||
|
displayHelp();
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
onStart();
|
||||||
|
echo("Engine initialized...");
|
||||||
|
|
||||||
|
// Auto-load on the 360
|
||||||
|
if( $platform $= "xenon" )
|
||||||
|
{
|
||||||
|
%mission = "levels/Empty Terrain.mis";
|
||||||
|
|
||||||
|
echo("Xbox360 Autoloading level: '" @ %mission @ "'");
|
||||||
|
|
||||||
|
|
||||||
|
if ($pref::HostMultiPlayer)
|
||||||
|
%serverType = "MultiPlayer";
|
||||||
|
else
|
||||||
|
%serverType = "SinglePlayer";
|
||||||
|
|
||||||
|
createAndConnectToLocalServer( %serverType, %mission );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display an error message for unused arguments
|
||||||
|
for ($i = 1; $i < $Game::argc; $i++) {
|
||||||
|
if (!$argUsed[$i])
|
||||||
|
error("Error: Unknown command line argument: " @ $Game::argv[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically start up the appropriate eidtor, if any
|
||||||
|
if ($startWorldEditor) {
|
||||||
|
Canvas.setCursor("DefaultCursor");
|
||||||
|
Canvas.setContent(EditorChooseLevelGui);
|
||||||
|
} else if ($startGUIEditor) {
|
||||||
|
Canvas.setCursor("DefaultCursor");
|
||||||
|
Canvas.setContent(EditorChooseGUI);
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
project("Torque3DEngine")
|
project("Torque3DEngine")
|
||||||
|
|
||||||
set(TORQUE_TEMPLATE "Empty" CACHE STRING "the template to use")
|
set(TORQUE_TEMPLATE "Full" CACHE STRING "the template to use")
|
||||||
|
|
||||||
set(projectDir "${CMAKE_SOURCE_DIR}/My Projects/${TORQUE_APP_NAME}")
|
set(projectDir "${CMAKE_SOURCE_DIR}/My Projects/${TORQUE_APP_NAME}")
|
||||||
set(projectOutDir "${projectDir}/game")
|
set(projectOutDir "${projectDir}/game")
|
||||||
|
|
@ -14,9 +14,6 @@ set(cmakeDir "${CMAKE_SOURCE_DIR}/Tools/CMake")
|
||||||
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${projectOutDir}/game)
|
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${projectOutDir}/game)
|
||||||
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${projectOutDir}/game)
|
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${projectOutDir}/game)
|
||||||
|
|
||||||
# change the default installation path to My Projects/app name
|
|
||||||
SET(CMAKE_INSTALL_PREFIX "${projectDir}" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
|
|
||||||
|
|
||||||
# finds and adds sources files in a folder
|
# finds and adds sources files in a folder
|
||||||
macro(addPath dir)
|
macro(addPath dir)
|
||||||
set(tmpa "")
|
set(tmpa "")
|
||||||
|
|
@ -117,12 +114,6 @@ endmacro()
|
||||||
|
|
||||||
# macro to add an executable
|
# macro to add an executable
|
||||||
macro(addExecutable)
|
macro(addExecutable)
|
||||||
# more paths?
|
|
||||||
if(${ARGC} GREATER 0)
|
|
||||||
foreach(dir ${ARGV0})
|
|
||||||
addPath("${dir}")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
# now inspect the paths we got
|
# now inspect the paths we got
|
||||||
set(firstDir "")
|
set(firstDir "")
|
||||||
foreach(dir ${${PROJECT_NAME}_paths})
|
foreach(dir ${${PROJECT_NAME}_paths})
|
||||||
|
|
@ -133,9 +124,7 @@ macro(addExecutable)
|
||||||
generateFilters("${firstDir}")
|
generateFilters("${firstDir}")
|
||||||
add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files})
|
add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files})
|
||||||
# omg - only use the first folder ... otehrwise we get lots of header name collisions
|
# omg - only use the first folder ... otehrwise we get lots of header name collisions
|
||||||
#foreach(dir ${${PROJECT_NAME}_paths})
|
|
||||||
addInclude("${firstDir}")
|
addInclude("${firstDir}")
|
||||||
#endforeach()
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
39
Tools/CMake/template.torsion.in
Normal file
39
Tools/CMake/template.torsion.in
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
<TorsionProject>
|
||||||
|
<Name>@TORQUE_APP_NAME@</Name>
|
||||||
|
<WorkingDir/>
|
||||||
|
<EntryScript>main.cs</EntryScript>
|
||||||
|
<DebugHook>dbgSetParameters( #port#, "#password#", true );</DebugHook>
|
||||||
|
<Mods>
|
||||||
|
<Folder>core</Folder>
|
||||||
|
<Folder>scripts</Folder>
|
||||||
|
<Folder>art</Folder>
|
||||||
|
<Folder>levels</Folder>
|
||||||
|
<Folder>shaders</Folder>
|
||||||
|
<Folder>tools</Folder>
|
||||||
|
</Mods>
|
||||||
|
<ScannerExts>cs; gui</ScannerExts>
|
||||||
|
<Configs>
|
||||||
|
<Config>
|
||||||
|
<Name>Release</Name>
|
||||||
|
<Executable>@TORQUE_APP_NAME@.exe</Executable>
|
||||||
|
<Arguments/>
|
||||||
|
<HasExports>true</HasExports>
|
||||||
|
<Precompile>true</Precompile>
|
||||||
|
<InjectDebugger>true</InjectDebugger>
|
||||||
|
<UseSetModPaths>false</UseSetModPaths>
|
||||||
|
</Config>
|
||||||
|
<Config>
|
||||||
|
<Name>Debug</Name>
|
||||||
|
<Executable>@TORQUE_APP_NAME@.exe</Executable>
|
||||||
|
<Arguments/>
|
||||||
|
<HasExports>true</HasExports>
|
||||||
|
<Precompile>true</Precompile>
|
||||||
|
<InjectDebugger>true</InjectDebugger>
|
||||||
|
<UseSetModPaths>false</UseSetModPaths>
|
||||||
|
</Config>
|
||||||
|
</Configs>
|
||||||
|
<SearchURL/>
|
||||||
|
<SearchProduct>@TORQUE_APP_NAME@</SearchProduct>
|
||||||
|
<SearchVersion>HEAD</SearchVersion>
|
||||||
|
<ExecModifiedScripts>true</ExecModifiedScripts>
|
||||||
|
</TorsionProject>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
project(torque3d)
|
project(${TORQUE_APP_NAME})
|
||||||
|
|
||||||
# TODO: fmod support
|
# TODO: fmod support
|
||||||
|
|
||||||
|
|
@ -317,12 +317,18 @@ endif()
|
||||||
if(NOT EXISTS "${projectSrcDir}/torque.ico")
|
if(NOT EXISTS "${projectSrcDir}/torque.ico")
|
||||||
CONFIGURE_FILE("${cmakeDir}/torque.ico" "${projectSrcDir}/torque.ico" COPYONLY)
|
CONFIGURE_FILE("${cmakeDir}/torque.ico" "${projectSrcDir}/torque.ico" COPYONLY)
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT EXISTS "${projectOutDir}/${PROJECT_NAME}.torsion")
|
||||||
|
CONFIGURE_FILE("${cmakeDir}/template.torsion.in" "${projectOutDir}/${PROJECT_NAME}.torsion")
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/main.cs.in" AND NOT EXISTS "${projectOutDir}/main.cs")
|
||||||
|
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/main.cs.in" "${projectOutDir}/main.cs")
|
||||||
|
endif()
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(NOT EXISTS "${projectSrcDir}/torque.rc")
|
if(NOT EXISTS "${projectSrcDir}/torque.rc")
|
||||||
CONFIGURE_FILE("${cmakeDir}/torque-win.rc.in" "${projectSrcDir}/torque.rc")
|
CONFIGURE_FILE("${cmakeDir}/torque-win.rc.in" "${projectSrcDir}/torque.rc")
|
||||||
endif()
|
endif()
|
||||||
if(NOT EXISTS "${projectDir}/cleanup.bat")
|
if(NOT EXISTS "${projectOutDir}/cleanup.bat")
|
||||||
CONFIGURE_FILE("${cmakeDir}/cleanup-win.bat.in" "${projectDir}/cleanup.bat")
|
CONFIGURE_FILE("${cmakeDir}/cleanup-win.bat.in" "${projectOutDir}/cleanup.bat")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
@ -435,12 +441,12 @@ endif()
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Installation
|
# Installation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
INSTALL_FILES(/ FILES ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game)
|
INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game" DESTINATION "${projectDir}")
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
INSTALL_FILES(/ FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/cleanShaders.bat")
|
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/cleanShaders.bat" DESTINATION "${projectDir}")
|
||||||
INSTALL_FILES(/ FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteCachedDTSs.bat")
|
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteCachedDTSs.bat" DESTINATION "${projectDir}")
|
||||||
INSTALL_FILES(/ FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteDSOs.bat")
|
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteDSOs.bat" DESTINATION "${projectDir}")
|
||||||
INSTALL_FILES(/ FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeletePrefs.bat")
|
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeletePrefs.bat" DESTINATION "${projectDir}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
INCLUDE(CPack)
|
INCLUDE(CPack)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue