Browse Source

updates to the baseProject template. You should now copy AppCore from the main project. Also, the readme has been markdown-ified.

Charlie Patterson 12 years ago
parent
commit
f318812

+ 24 - 0
templates/baseProject/README - setup.md

@@ -0,0 +1,24 @@
+## What Is This `BaseProject` Directory
+
+`baseProject` is a template project for starting a Torque2D game from scratch.  You don't have to start here, but it should be easy to do so.
+
+## What Does a Torque2D Game Project Consist Of?
+
+In its simplest form, a project consists of a top-level directory with the following contents:
+
+* the Torque2D game engine
+* a `main.cs` script file, which the engine runs when it starts
+* almost certainly a `modules` directory containing one or more modules of game assets and scripts
+* almost certainly a bootstrap module, such as `AppCore`, to setup common variables and other required bits for the engine.
+
+## How To Start With This `baseProject`
+
+1. If you do not have a copy of the Torque2D binary, obtain or compile one.
+2. Copy this "baseProject" directory to wherever you want to create the project.  This becomes the main project directory.
+3. If you are running Windows, copy the following files from your Torque2D original to this directory:
+  * Torque2D.app
+  * OpenAL32.dll
+	* unicows.dll
+4. If you are running OSX, copy the following files from your Torque2D original to this directory:
+  * Torque2D(.app)
+5. Go to your Torque2D original and copy the modules/AppCore directory to this projects modules/ directory.

+ 0 - 10
templates/baseProject/README - setup.txt

@@ -1,10 +0,0 @@
-baseProject is a template for starting a Torque2D game from scratch.
-
-1. Copy this "baseProject" directory to wherever you want to create the project.  This becomes the main project directory.
-2. If you are running Windows, copy the following files from your Torque2D original source to your copy of baseProject:
-	* OpenAL32.dll
-	* unicows.dll
-3. Copy the engine into "baseProject" as well.  To do this you may need to obtain or compile a copy.  Either
-	* compile the original Torque2D engine if you have not.
-	* Then copy it here.  It will be named Torque2D.exe (for Windows) or Torque2D.app (for Mac OSX).
-3b. Alternatively you may want to copy the original "engine" directory here, and then build and modify your copy as part of this project.

+ 0 - 4
templates/baseProject/modules/AppCore/1/fonts/.gitignore

@@ -1,4 +0,0 @@
-# Ignore everything in this directory
-*
-# Except this file
-!.gitignore

+ 0 - 54
templates/baseProject/modules/AppCore/1/main.cs

@@ -1,54 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 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.
-//-----------------------------------------------------------------------------
-
-function AppCore::create( %this )
-{
-    // Load system scripts
-    exec("./scripts/constants.cs");
-    exec("./scripts/defaultPreferences.cs");
-    exec("./scripts/canvas.cs");
-    exec("./scripts/openal.cs");
-    
-    // Initialize the canvas
-    initializeCanvas("Torque 2D");
-    
-    // Set the canvas color
-    Canvas.BackgroundColor = "CornflowerBlue";
-    Canvas.UseBackgroundColor = true;
-    
-    // Initialize audio
-    initializeOpenAL();
-    
-    // This is one method of starting your game.
-    // Edit your "main" module(s) to have an attribute of Group="gameBase".
-    // Then uncomment the following line.
-    // Now the "AppCore" will go first and then start your game.
-    // ModuleDatabase.loadGroup("gameBase");
-}
-
-//-----------------------------------------------------------------------------
-
-function AppCore::destroy( %this )
-{
-
-}
-

+ 0 - 7
templates/baseProject/modules/AppCore/1/module.taml

@@ -1,7 +0,0 @@
-<ModuleDefinition
-	ModuleId="AppCore"
-	VersionId="1"
-	Description="Barebones startup module"
-	ScriptFile="main.cs"
-	CreateFunction="create"
-	DestroyFunction="destroy" />

+ 0 - 133
templates/baseProject/modules/AppCore/1/scripts/canvas.cs

@@ -1,133 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 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.
-//-----------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-// initializeCanvas
-// Constructs and initializes the default canvas window.
-//------------------------------------------------------------------------------
-$canvasCreated = false;
-function initializeCanvas(%windowName)
-{
-    // Don't duplicate the canvas.
-    if($canvasCreated)
-    {
-        error("Cannot instantiate more than one canvas!");
-        return;
-    }
-
-    videoSetGammaCorrection($pref::OpenGL::gammaCorrection);
-
-    if ( !createCanvas(%windowName) )
-    {
-        error("Canvas creation failed. Shutting down.");
-        quit();
-    }
-
-    $pref::iOS::ScreenDepth = 32;
-
-    if ( $pref::iOS::DeviceType !$= "" )
-    {
-        %resolution = iOSResolutionFromSetting($pref::iOS::DeviceType, $pref::iOS::ScreenOrientation);
-    }
-    else
-    {
-        if ( $pref::Video::windowedRes !$= "" )
-            %resolution = $pref::Video::windowedRes;
-        else
-            %resolution = $pref::Video::defaultResolution;
-    }
-
-    if ($platform $= "windows" || $platform $= "macos")
-    {
-        setScreenMode( %resolution._0, %resolution._1, %resolution._2, $pref::Video::fullScreen );
-    }
-    else
-    {
-        setScreenMode( %resolution._0, %resolution._1, %resolution._2, false );
-    }
-
-    $canvasCreated = true;
-}
-
-//------------------------------------------------------------------------------
-// resetCanvas
-// Forces the canvas to redraw itself.
-//------------------------------------------------------------------------------
-function resetCanvas()
-{
-    if (isObject(Canvas))
-        Canvas.repaint();
-}
-
-//------------------------------------------------------------------------------
-// iOSResolutionFromSetting
-// Helper function that grabs resolution strings based on device type
-//------------------------------------------------------------------------------
-function iOSResolutionFromSetting( %deviceType, %deviceScreenOrientation )
-{
-    // A helper function to get a string based resolution from the settings given.
-    %x = 0;
-    %y = 0;
-    
-    %scaleFactor = $pref::iOS::RetinaEnabled ? 2 : 1;
-
-    switch(%deviceType)
-    {
-        case $iOS::constant::iPhone:
-            if(%deviceScreenOrientation == $iOS::constant::Landscape)
-            {
-                %x =  $iOS::constant::iPhoneWidth * %scaleFactor;
-                %y =  $iOS::constant::iPhoneHeight * %scaleFactor;
-            }
-            else
-            {
-                %x =  $iOS::constant::iPhoneHeight * %scaleFactor;
-                %y =  $iOS::constant::iPhoneWidth * %scaleFactor;
-            }
-
-        case $iOS::constant::iPad:
-            if(%deviceScreenOrientation == $iOS::constant::Landscape)
-            {
-                %x =  $iOS::constant::iPadWidth * %scaleFactor;
-                %y =  $iOS::constant::iPadHeight * %scaleFactor;
-            }
-            else
-            {
-                %x =  $iOS::constant::iPadHeight * %scaleFactor;
-                %y =  $iOS::constant::iPadWidth * %scaleFactor;
-            }
-
-        case $iOS::constant::iPhone5:
-            if(%deviceScreenOrientation == $iOS::constant::Landscape)
-            {
-                %x =  $iOS::constant::iPhone5Width;
-                %y =  $iOS::constant::iPhone5Height;
-            }
-            else
-            {
-                %x =  $iOS::constant::iPhone5Height;
-                %y =  $iOS::constant::iPhone5Width;
-            }
-    }
-   
-    return %x @ " " @ %y;
-}

+ 0 - 51
templates/baseProject/modules/AppCore/1/scripts/constants.cs

@@ -1,51 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 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.
-//-----------------------------------------------------------------------------
-
-$iOS::constant::iPhone = 0;
-$iOS::constant::iPad = 1;
-$iOS::constant::iPhone5 = 2;
-
-$iOS::constant::Landscape = 0;
-$iOS::constant::Portrait = 1;
-$iOS::constant::ResolutionFull = 0;
-$iOS::constant::ResolutionSmall = 1;
-
-$iOS::constant::iPhoneWidth = 480;
-$iOS::constant::iPhoneHeight = 320;
-
-$iOS::constant::iPhone4Width = 960;
-$iOS::constant::iPhone4Height = 640;
-
-$iOS::constant::iPadWidth = 1024;
-$iOS::constant::iPadHeight = 768;
-
-$iOS::constant::NewiPadWidth = 2048;
-$iOS::constant::NewiPadHeight = 1536;
-
-$iOS::constant::iPhone5Width = 1136;
-$iOS::constant::iPhone5Height = 640;
-
-$iOS::constant::OrientationUnknown = 0;
-$iOS::constant::OrientationLandscapeLeft = 1;
-$iOS::constant::OrientationLandscapeRight = 2;
-$iOS::constant::OrientationPortrait = 3;
-$iOS::constant::OrientationPortraitUpsideDown = 4;

+ 0 - 68
templates/baseProject/modules/AppCore/1/scripts/defaultPreferences.cs

@@ -1,68 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 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.
-//-----------------------------------------------------------------------------
-
-/// Game
-$Game::CompanyName              = "GarageGames LLC";
-$Game::ProductName              = "Torque 2D";
-
-/// iOS
-$pref::iOS::ScreenOrientation   = $iOS::constant::Landscape;
-$pref::iOS::ScreenDepth		    = 32;
-$pref::iOS::UseGameKit          = 0;
-$pref::iOS::UseMusic            = 0;
-$pref::iOS::UseMoviePlayer      = 0;
-$pref::iOS::UseAutoRotate       = 1;
-$pref::iOS::EnableOrientationRotation = 1;
-$pref::iOS::EnableOtherOrientationRotation = 1;   
-$pref::iOS::StatusBarType       = 0;
-
-/// Audio
-$pref::Audio::driver = "OpenAL";
-$pref::Audio::forceMaxDistanceUpdate = 0;
-$pref::Audio::environmentEnabled = 0;
-$pref::Audio::masterVolume   = 1.0;
-$pref::Audio::channelVolume1 = 1.0;
-$pref::Audio::channelVolume2 = 1.0;
-$pref::Audio::channelVolume3 = 1.0;
-$pref::Audio::sfxVolume = 1.0;
-$pref::Audio::musicVolume = 1.0;
-
-/// T2D
-$pref::T2D::ParticlePlayerEmissionRateScale = 1.0;
-$pref::T2D::ParticlePlayerSizeScale = 1.0;
-$pref::T2D::ParticlePlayerForceScale = 1.0;
-$pref::T2D::warnFileDeprecated = 1;
-$pref::T2D::warnSceneOccupancy = 1;
-$pref::T2D::imageAssetGlobalFilterMode = Bilinear;
-
-/// Video
-$pref::Video::appliedPref = 0;
-$pref::Video::disableVerticalSync = 1;
-$pref::Video::displayDevice = "OpenGL";
-$pref::Video::preferOpenGL = 1;
-$pref::Video::fullScreen = 0;
-$pref::Video::defaultResolution = "1024 768";
-$pref::Video::windowedRes = "1024 768 32";
-$pref::OpenGL::gammaCorrection = 0.5;
-
-/// Fonts.
-$Gui::fontCacheDirectory = expandPath( "^AppCore/fonts" );

+ 0 - 64
templates/baseProject/modules/AppCore/1/scripts/openal.cs

@@ -1,64 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 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.
-//-----------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-// Audio channel descriptions.
-//------------------------------------------------------------------------------
-$musicAudioType = 1;
-$effectsAudioType = 2;
-
-//------------------------------------------------------------------------------
-// initializeOpenAL
-// Starts up the OpenAL driver.
-//------------------------------------------------------------------------------
-function initializeOpenAL()
-{
-    // Just in case it is already started.
-    shutdownOpenAL();
-
-    echo("OpenAL Driver Init");
-
-    if (!OpenALInitDriver())
-    {
-        echo("OpenALInitDriver() failed");
-        $Audio::initFailed = true;
-    }
-    else
-    {
-        // Set the master volume.
-        alxListenerf(AL_GAIN_LINEAR, $pref::Audio::masterVolume);
-
-        // Set the channel volumes.
-        for (%channel = 1; %channel <= 3; %channel++)
-            alxSetChannelVolume(%channel, $pref::Audio::channelVolume[%channel]);
-
-        echo("OpenAL Driver Init Success");
-    }
-}
-
-//------------------------------------------------------------------------------
-// shutdownOpenAL
-//------------------------------------------------------------------------------
-function shutdownOpenAL()
-{
-    OpenALShutdownDriver();
-}