No init.cs in tutorial.base file
by Allan Seguin · in General Discussion · 04/16/2008 (11:34 pm) · 3 replies
I have now heavly editied the tutorial.base main.cs file to make most of my gui but now i am finding that many thigs require this init.cs file
I don't under stand why and even how to make one work properly with the tutorial.base files...... has any one else know what i can do or the best way to tackel this problem....
~Allan
I don't under stand why and even how to make one work properly with the tutorial.base files...... has any one else know what i can do or the best way to tackel this problem....
~Allan
#2
04/17/2008 (5:42 am)
@Allan - Have a look at this tutorial I wrote (Part 1 of a 3 part series) Getting Started Tutorial 1
#3
make sure there are no syntax errors.
2. exec it
3. make sure you set the content of your SplashScreenGui into the Canvas instead of MainMenuGui:
Canvas.setContent(SplashScreenGui);
I believe these are the only 3 steps needed to get a gui to show up before the main menu.
In the InitClient routine above, I don't see my steps 2 and 3 being performed.
no: exec("./client/ggsplash.gui"); // assuming this is where it is located
and you specifically load the MainMenuGui into the canvas at the bottom of the InitClient method.
04/17/2008 (9:37 am)
1. Make a splash screen gui (for example: SplashScreenGui in splashScreenGui.csmake sure there are no syntax errors.
2. exec it
3. make sure you set the content of your SplashScreenGui into the Canvas instead of MainMenuGui:
Canvas.setContent(SplashScreenGui);
I believe these are the only 3 steps needed to get a gui to show up before the main menu.
In the InitClient routine above, I don't see my steps 2 and 3 being performed.
no: exec("./client/ggsplash.gui"); // assuming this is where it is located
and you specifically load the MainMenuGui into the canvas at the bottom of the InitClient method.
Allan Seguin
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
// Load up common script base
loadDir("common");
//-----------------------------------------------------------------------------
// Load up default console values.
exec("./client/defaults.cs");
exec("./server/defaults.cs");
// Preferences (overide defaults)
exec("./prefs.cs");
//-----------------------------------------------------------------------------
// Package overrides to initialize the game
package ttb {
function onStart()
{
// Initialize the client and the server
Parent::onStart();
initServer();
initClient();
$Editor::newMissionOverride = "DarkSkies/data/missions/flat.mis";
}
function onExit()
{
// Save off our current preferences for next time
echo("Exporting prefs");
export("$Pref::*", "./prefs.cs", False);
Parent::onExit();
}
}; // Client package
activatePackage(ttb);
//-----------------------------------------------------------------------------
function initServer()
{
echo("\n--------- Initializing TTB: Server ---------");
// The common module provides the basic server functionality
initBaseServer();
// Load up game server support scripts
exec("./server/game.cs");
}
//-----------------------------------------------------------------------------
function initClient()
{
echo("\n--------- Initializing TTB: Client ---------");
// The common module provides basic client functionality
initBaseClient();
// InitCanvas starts up the graphics system.
// The canvas needs to be constructed before the gui scripts are
// run because many of the controls assume the canvas exists at
// load time.
initCanvas("DarkSkies");
// Load client-side Audio Profiles/Descriptions
exec("./client/audioProfiles.cs");
// Load up the shell and game GUIs
exec("./client/ui/PlayGui.gui");
exec("./client/ui/mainMenuGui.gui");
exec("./client/ui/optionsDlg.gui");
exec("./client/ui/loadingGui.gui");
exec("./client/ui/StartGui.gui");
exec("./client/ui/ChooseGui.gui");
// Client scripts
exec("./client/optionsDlg.cs");
exec("./client/missionDownload.cs");
exec("./client/serverConnection.cs");
exec("./client/loadingGui.cs");
exec("./client/playGui.cs");
// Default player key bindings
exec("./client/default.bind.cs");
// Copy saved script prefs into C++ code.
setShadowDetailLevel( $pref::shadows );
setDefaultFov( $pref::Player::defaultFov );
setZoomSpeed( $pref::Player::zoomSpeed );
// Start up the main menu...
Canvas.setContent(MainMenuGui);
Canvas.setCursor("DefaultCursor");
}
//-----------------------------------------------------------------------------
// LOAD MY MISSION
function loadMyMission()
{
// make sure we are not connected to a server already
disconnect();
// Create the server and load the mission
createServer("SinglePlayer", expandFilename("./data/missions/flat.mis"));
// Make a local connection
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs("Player");
%conn.setJoinPassword("None");
%conn.connectLocal();
}
function loadMyMission2()
{
// make sure we are not connected to a server already
disconnect();
// Create the server and load the mission
createServer("SinglePlayer", expandFilename("./data/missions/flat2.mis"));
// Make a local connection
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs("Player");
%conn.setJoinPassword("None");
%conn.connectLocal();
}