added everything
65
example/starter.racing/client/defaults.cs
Executable file
@ -0,0 +1,65 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// The master server is declared with the server defaults, which is
|
||||
// loaded on both clients & dedicated servers. If the server mod
|
||||
// is not loaded on a client, then the master must be defined.
|
||||
// $pref::Master[0] = "2:master.garagegames.com:28002";
|
||||
|
||||
$pref::Player::Name = "Rotten Wheels";
|
||||
$pref::Player::defaultFov = 90;
|
||||
$pref::Player::zoomSpeed = 0;
|
||||
|
||||
$pref::Net::LagThreshold = 400;
|
||||
$pref::Net::Port = 28000;
|
||||
|
||||
$pref::shadows = "2";
|
||||
$pref::HudMessageLogSize = 40;
|
||||
$pref::ChatHudLength = 1;
|
||||
|
||||
|
||||
$pref::Input::LinkMouseSensitivity = 1;
|
||||
$pref::Input::MouseEnabled = 0;
|
||||
$pref::Input::JoystickEnabled = 0;
|
||||
$pref::Input::KeyboardTurnSpeed = 0.1;
|
||||
|
||||
$pref::sceneLighting::cacheSize = 20000;
|
||||
$pref::sceneLighting::purgeMethod = "lastCreated";
|
||||
$pref::sceneLighting::cacheLighting = 1;
|
||||
$pref::sceneLighting::terrainGenerateLevel = 1;
|
||||
|
||||
$pref::ts::detailAdjust = 0.45;
|
||||
|
||||
$pref::Terrain::DynamicLights = 1;
|
||||
$pref::Interior::TexturedFog = 0;
|
||||
|
||||
$pref::Video::displayDevice = "OpenGL";
|
||||
$pref::Video::allowOpenGL = 1;
|
||||
$pref::Video::allowD3D = 1;
|
||||
$pref::Video::preferOpenGL = 1;
|
||||
$pref::Video::appliedPref = 0;
|
||||
$pref::Video::disableVerticalSync = 1;
|
||||
$pref::Video::monitorNum = 0;
|
||||
$pref::Video::windowedRes = "800 600";
|
||||
$pref::Video::screenShotFormat = "PNG";
|
||||
|
||||
$pref::OpenGL::force16BitTexture = "0";
|
||||
$pref::OpenGL::forcePalettedTexture = "0";
|
||||
$pref::OpenGL::maxHardwareLights = 3;
|
||||
$pref::VisibleDistanceMod = 1.0;
|
||||
|
||||
$pref::Audio::driver = "OpenAL";
|
||||
$pref::Audio::forceMaxDistanceUpdate = 0;
|
||||
$pref::Audio::environmentEnabled = 0;
|
||||
$pref::Audio::masterVolume = 0.8;
|
||||
$pref::Audio::channelVolume1 = 0.8;
|
||||
$pref::Audio::channelVolume2 = 0.8;
|
||||
$pref::Audio::channelVolume3 = 0.8;
|
||||
$pref::Audio::channelVolume4 = 0.8;
|
||||
$pref::Audio::channelVolume5 = 0.8;
|
||||
$pref::Audio::channelVolume6 = 0.8;
|
||||
$pref::Audio::channelVolume7 = 0.8;
|
||||
$pref::Audio::channelVolume8 = 0.8;
|
||||
|
135
example/starter.racing/client/init.cs
Executable file
@ -0,0 +1,135 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Variables used by client scripts & code. The ones marked with (c)
|
||||
// are accessed from code. Variables preceeded by Pref:: are client
|
||||
// preferences and stored automatically in the ~/client/prefs.cs file
|
||||
// in between sessions.
|
||||
//
|
||||
// (c) Client::MissionFile Mission file name
|
||||
// ( ) Client::Password Password for server join
|
||||
|
||||
// (?) Pref::Player::CurrentFOV
|
||||
// (?) Pref::Player::DefaultFov
|
||||
// ( ) Pref::Input::KeyboardTurnSpeed
|
||||
|
||||
// (c) pref::Master[n] List of master servers
|
||||
// (c) pref::Net::RegionMask
|
||||
// (c) pref::Client::ServerFavoriteCount
|
||||
// (c) pref::Client::ServerFavorite[FavoriteCount]
|
||||
// .. Many more prefs... need to finish this off
|
||||
|
||||
// Moves, not finished with this either...
|
||||
// (c) firstPerson
|
||||
// $mv*Action...
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function initClient()
|
||||
{
|
||||
echo("\n--------- Initializing MOD: FPS Starter Kit: Client ---------");
|
||||
|
||||
// Make sure this variable reflects the correct state.
|
||||
$Server::Dedicated = false;
|
||||
|
||||
// Game information used to query the master server
|
||||
$Client::GameTypeQuery = "FPS Starter Kit";
|
||||
$Client::MissionTypeQuery = "Any";
|
||||
|
||||
//
|
||||
exec("./ui/customProfiles.cs"); // override the base profiles if necessary
|
||||
|
||||
// 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("Torque Game Engine");
|
||||
|
||||
/// Load client-side Audio Profiles/Descriptions
|
||||
exec("./scripts/audioProfiles.cs");
|
||||
|
||||
// Load up the Game GUIs
|
||||
exec("./ui/defaultGameProfiles.cs");
|
||||
exec("./ui/PlayGui.gui");
|
||||
exec("./ui/ChatHud.gui");
|
||||
exec("./ui/playerList.gui");
|
||||
|
||||
// Load up the shell GUIs
|
||||
exec("./ui/mainMenuGui.gui");
|
||||
exec("./ui/aboutDlg.gui");
|
||||
exec("./ui/startMissionGui.gui");
|
||||
exec("./ui/joinServerGui.gui");
|
||||
exec("./ui/loadingGui.gui");
|
||||
exec("./ui/endGameGui.gui");
|
||||
exec("./ui/optionsDlg.gui");
|
||||
exec("./ui/remapDlg.gui");
|
||||
exec("./ui/StartupGui.gui");
|
||||
|
||||
// Client scripts
|
||||
exec("./scripts/client.cs");
|
||||
exec("./scripts/game.cs");
|
||||
exec("./scripts/missionDownload.cs");
|
||||
exec("./scripts/serverConnection.cs");
|
||||
exec("./scripts/playerList.cs");
|
||||
exec("./scripts/loadingGui.cs");
|
||||
exec("./scripts/optionsDlg.cs");
|
||||
exec("./scripts/chatHud.cs");
|
||||
exec("./scripts/messageHud.cs");
|
||||
exec("./scripts/playGui.cs");
|
||||
exec("./scripts/centerPrint.cs");
|
||||
|
||||
// Default player key bindings
|
||||
exec("./scripts/default.bind.cs");
|
||||
exec("./config.cs");
|
||||
|
||||
// Really shouldn't be starting the networking unless we are
|
||||
// going to connect to a remote server, or host a multi-player
|
||||
// game.
|
||||
setNetPort(0);
|
||||
|
||||
// Copy saved script prefs into C++ code.
|
||||
setShadowDetailLevel( $pref::shadows );
|
||||
setDefaultFov( $pref::Player::defaultFov );
|
||||
setZoomSpeed( $pref::Player::zoomSpeed );
|
||||
|
||||
// Start up the main menu... this is separated out into a
|
||||
// method for easier mod override.
|
||||
|
||||
if ($JoinGameAddress !$= "") {
|
||||
// If we are instantly connecting to an address, load the
|
||||
// main menu then attempt the connect.
|
||||
loadMainMenu();
|
||||
connect($JoinGameAddress, "", $Pref::Player::Name);
|
||||
}
|
||||
else {
|
||||
// Otherwise go to the splash screen.
|
||||
Canvas.setCursor("DefaultCursor");
|
||||
loadStartup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
function loadMainMenu()
|
||||
{
|
||||
// Startup the client with the Main menu...
|
||||
Canvas.setContent( MainMenuGui );
|
||||
|
||||
|
||||
// Make sure the audio initialized.
|
||||
if($Audio::initFailed) {
|
||||
MessageBoxOK("Audio Initialization Failed",
|
||||
"The OpenAL audio system failed to initialize. " @
|
||||
"You can get the most recent OpenAL drivers <a:www.garagegames.com/docs/torque/gstarted/openal.html>here</a>.");
|
||||
}
|
||||
|
||||
Canvas.setCursor("DefaultCursor");
|
||||
}
|
||||
|
||||
|
47
example/starter.racing/client/scripts/audioProfiles.cs
Executable file
@ -0,0 +1,47 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Channel assignments (channel 0 is unused in-game).
|
||||
|
||||
$GuiAudioType = 1;
|
||||
$SimAudioType = 2;
|
||||
$MessageAudioType = 3;
|
||||
|
||||
new AudioDescription(AudioGui)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = $GuiAudioType;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioMessage)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = $MessageAudioType;
|
||||
};
|
||||
|
||||
new AudioProfile(AudioButtonOver)
|
||||
{
|
||||
filename = "~/data/sound/buttonOver.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(AudioCountBeep)
|
||||
{
|
||||
filename = "~/data/sound/beep1.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(AudioGoBeep)
|
||||
{
|
||||
filename = "~/data/sound/beep2.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
78
example/starter.racing/client/scripts/centerPrint.cs
Executable file
@ -0,0 +1,78 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$centerPrintActive = 0;
|
||||
$bottomPrintActive = 0;
|
||||
|
||||
// Selectable window sizes
|
||||
$CenterPrintSizes[1] = 20;
|
||||
$CenterPrintSizes[2] = 36;
|
||||
$CenterPrintSizes[3] = 56;
|
||||
|
||||
// time is specified in seconds
|
||||
function clientCmdCenterPrint( %message, %time, %size )
|
||||
{
|
||||
// if centerprint already visible, reset text and time.
|
||||
if ($centerPrintActive) {
|
||||
if (centerPrintDlg.removePrint !$= "")
|
||||
cancel(centerPrintDlg.removePrint);
|
||||
}
|
||||
else {
|
||||
CenterPrintDlg.visible = 1;
|
||||
$centerPrintActive = 1;
|
||||
}
|
||||
|
||||
CenterPrintText.setText( "<just:center>" @ %message );
|
||||
CenterPrintDlg.extent = firstWord(CenterPrintDlg.extent) @ " " @ $CenterPrintSizes[%size];
|
||||
|
||||
if (%time > 0)
|
||||
centerPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearCenterPrint" );
|
||||
}
|
||||
|
||||
// time is specified in seconds
|
||||
function clientCmdBottomPrint( %message, %time, %size )
|
||||
{
|
||||
// if bottomprint already visible, reset text and time.
|
||||
if ($bottomPrintActive) {
|
||||
if( bottomPrintDlg.removePrint !$= "")
|
||||
cancel(bottomPrintDlg.removePrint);
|
||||
}
|
||||
else {
|
||||
bottomPrintDlg.setVisible(true);
|
||||
$bottomPrintActive = 1;
|
||||
}
|
||||
|
||||
bottomPrintText.setText( "<just:center>" @ %message );
|
||||
bottomPrintDlg.extent = firstWord(bottomPrintDlg.extent) @ " " @ $CenterPrintSizes[%size];
|
||||
|
||||
if (%time > 0)
|
||||
bottomPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearbottomPrint" );
|
||||
}
|
||||
|
||||
function BottomPrintText::onResize(%this, %width, %height)
|
||||
{
|
||||
%this.position = "0 0";
|
||||
}
|
||||
|
||||
function CenterPrintText::onResize(%this, %width, %height)
|
||||
{
|
||||
%this.position = "0 0";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
function clientCmdClearCenterPrint()
|
||||
{
|
||||
$centerPrintActive = 0;
|
||||
CenterPrintDlg.visible = 0;
|
||||
CenterPrintDlg.removePrint = "";
|
||||
}
|
||||
|
||||
function clientCmdClearBottomPrint()
|
||||
{
|
||||
$bottomPrintActive = 0;
|
||||
BottomPrintDlg.visible = 0;
|
||||
BottomPrintDlg.removePrint = "";
|
||||
}
|
286
example/starter.racing/client/scripts/chatHud.cs
Executable file
@ -0,0 +1,286 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Message Hud
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// chat hud sizes
|
||||
$outerChatLenY[1] = 72;
|
||||
$outerChatLenY[2] = 140;
|
||||
$outerChatLenY[3] = 200;
|
||||
|
||||
// Only play sound files that are <= 5000ms in length.
|
||||
$MaxMessageWavLength = 5000;
|
||||
|
||||
// Helper function to play a sound file if the message indicates.
|
||||
// Returns starting position of wave file indicator.
|
||||
function playMessageSound(%message, %voice, %pitch)
|
||||
{
|
||||
// Search for wav tag marker.
|
||||
%wavStart = strstr(%message, "~w");
|
||||
if (%wavStart == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
%wav = getSubStr(%message, %wavStart + 2, 1000);
|
||||
if (%voice !$= "") {
|
||||
%wavFile = "~/data/sound/voice/" @ %voice @ "/" @ %wav;
|
||||
}
|
||||
else {
|
||||
%wavFile = "~/data/sound/" @ %wav;
|
||||
}
|
||||
if (strstr(%wavFile, ".wav") != (strlen(%wavFile) - 4)) {
|
||||
%wavFile = %wavFile @ ".wav";
|
||||
}
|
||||
// XXX This only expands to a single filepath, of course; it
|
||||
// would be nice to support checking in each mod path if we
|
||||
// have multiple mods active.
|
||||
%wavFile = ExpandFilename(%wavFile);
|
||||
|
||||
if ((%pitch < 0.5) || (%pitch > 2.0)) {
|
||||
%pitch = 1.0;
|
||||
}
|
||||
|
||||
%wavLengthMS = alxGetWaveLen(%wavFile) * %pitch;
|
||||
if (%wavLengthMS == 0) {
|
||||
error("** WAV file \"" @ %wavFile @ "\" is nonexistent or sound is zero-length **");
|
||||
}
|
||||
else if (%wavLengthMS <= $MaxMessageWavLength) {
|
||||
if ($ClientChatHandle[%sender] != 0) {
|
||||
alxStop($ClientChatHandle[%sender]);
|
||||
}
|
||||
$ClientChatHandle[%sender] = alxCreateSource(AudioMessage, %wavFile);
|
||||
if (%pitch != 1.0) {
|
||||
alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %pitch);
|
||||
}
|
||||
alxPlay($ClientChatHandle[%sender]);
|
||||
}
|
||||
else {
|
||||
error("** WAV file \"" @ %wavFile @ "\" is too long **");
|
||||
}
|
||||
|
||||
return %wavStart;
|
||||
}
|
||||
|
||||
|
||||
// All messages are stored in this HudMessageVector, the actual
|
||||
// MainChatHud only displays the contents of this vector.
|
||||
|
||||
new MessageVector(HudMessageVector);
|
||||
$LastHudTarget = 0;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
function onChatMessage(%message, %voice, %pitch)
|
||||
{
|
||||
// XXX Client objects on the server must have voiceTag and voicePitch
|
||||
// fields for values to be passed in for %voice and %pitch... in
|
||||
// this example mod, they don't have those fields.
|
||||
|
||||
// Clients are not allowed to trigger general game sounds with their
|
||||
// chat messages... a voice directory MUST be specified.
|
||||
if (%voice $= "") {
|
||||
%voice = "default";
|
||||
}
|
||||
|
||||
// See if there's a sound at the end of the message, and play it.
|
||||
if ((%wavStart = playMessageSound(%message, %voice, %pitch)) != -1) {
|
||||
// Remove the sound marker from the end of the message.
|
||||
%message = getSubStr(%message, 0, %wavStart);
|
||||
}
|
||||
|
||||
// Chat goes to the chat HUD.
|
||||
if (getWordCount(%message)) {
|
||||
ChatHud.addLine(%message);
|
||||
}
|
||||
}
|
||||
|
||||
function onServerMessage(%message)
|
||||
{
|
||||
// See if there's a sound at the end of the message, and play it.
|
||||
if ((%wavStart = playMessageSound(%message)) != -1) {
|
||||
// Remove the sound marker from the end of the message.
|
||||
%message = getSubStr(%message, 0, %wavStart);
|
||||
}
|
||||
|
||||
// Server messages go to the chat HUD too.
|
||||
if (getWordCount(%message)) {
|
||||
ChatHud.addLine(%message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MainChatHud methods
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function MainChatHud::onWake( %this )
|
||||
{
|
||||
// set the chat hud to the users pref
|
||||
%this.setChatHudLength( $Pref::ChatHudLength );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MainChatHud::setChatHudLength( %this, %length )
|
||||
{
|
||||
OuterChatHud.resize(firstWord(OuterChatHud.position), getWord(OuterChatHud.position, 1),
|
||||
firstWord(OuterChatHud.extent), $outerChatLenY[%length]);
|
||||
ChatScrollHud.scrollToBottom();
|
||||
ChatPageDown.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MainChatHud::nextChatHudLen( %this )
|
||||
{
|
||||
%len = $pref::ChatHudLength++;
|
||||
if ($pref::ChatHudLength == 4)
|
||||
$pref::ChatHudLength = 1;
|
||||
%this.setChatHudLength($pref::ChatHudLength);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ChatHud methods
|
||||
// This is the actual message vector/text control which is part of
|
||||
// the MainChatHud dialog
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function ChatHud::addLine(%this,%text)
|
||||
{
|
||||
//first, see if we're "scrolled up"...
|
||||
%textHeight = %this.profile.fontSize;
|
||||
if (%textHeight <= 0)
|
||||
%textHeight = 12;
|
||||
%chatScrollHeight = getWord(%this.getGroup().getGroup().extent, 1);
|
||||
%chatPosition = getWord(%this.extent, 1) - %chatScrollHeight + getWord(%this.position, 1);
|
||||
%linesToScroll = mFloor((%chatPosition / %textHeight) + 0.5);
|
||||
if (%linesToScroll > 0)
|
||||
%origPosition = %this.position;
|
||||
|
||||
//add the message...
|
||||
while( !chatPageDown.isVisible() && HudMessageVector.getNumLines() && (HudMessageVector.getNumLines() >= $pref::HudMessageLogSize))
|
||||
{
|
||||
%tag = HudMessageVector.getLineTag(0);
|
||||
if(%tag != 0)
|
||||
%tag.delete();
|
||||
HudMessageVector.popFrontLine();
|
||||
}
|
||||
HudMessageVector.pushBackLine(%text, $LastHudTarget);
|
||||
$LastHudTarget = 0;
|
||||
|
||||
//now that we've added the message, see if we need to reset the position
|
||||
if (%linesToScroll > 0)
|
||||
{
|
||||
chatPageDown.setVisible(true);
|
||||
%this.position = %origPosition;
|
||||
}
|
||||
else
|
||||
chatPageDown.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function ChatHud::pageUp(%this)
|
||||
{
|
||||
// Find out the text line height
|
||||
%textHeight = %this.profile.fontSize;
|
||||
if (%textHeight <= 0)
|
||||
%textHeight = 12;
|
||||
|
||||
// Find out how many lines per page are visible
|
||||
%chatScrollHeight = getWord(%this.getGroup().getGroup().extent, 1);
|
||||
if (%chatScrollHeight <= 0)
|
||||
return;
|
||||
|
||||
%pageLines = mFloor(%chatScrollHeight / %textHeight) - 1;
|
||||
if (%pageLines <= 0)
|
||||
%pageLines = 1;
|
||||
|
||||
// See how many lines we actually can scroll up:
|
||||
%chatPosition = -1 * getWord(%this.position, 1);
|
||||
%linesToScroll = mFloor((%chatPosition / %textHeight) + 0.5);
|
||||
if (%linesToScroll <= 0)
|
||||
return;
|
||||
|
||||
if (%linesToScroll > %pageLines)
|
||||
%scrollLines = %pageLines;
|
||||
else
|
||||
%scrollLines = %linesToScroll;
|
||||
|
||||
// Now set the position
|
||||
%this.position = firstWord(%this.position) SPC (getWord(%this.position, 1) + (%scrollLines * %textHeight));
|
||||
|
||||
// Display the pageup icon
|
||||
chatPageDown.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function ChatHud::pageDown(%this)
|
||||
{
|
||||
// Find out the text line height
|
||||
%textHeight = %this.profile.fontSize;
|
||||
if (%textHeight <= 0)
|
||||
%textHeight = 12;
|
||||
|
||||
// Find out how many lines per page are visible
|
||||
%chatScrollHeight = getWord(%this.getGroup().getGroup().extent, 1);
|
||||
if (%chatScrollHeight <= 0)
|
||||
return;
|
||||
|
||||
%pageLines = mFloor(%chatScrollHeight / %textHeight) - 1;
|
||||
if (%pageLines <= 0)
|
||||
%pageLines = 1;
|
||||
|
||||
// See how many lines we actually can scroll down:
|
||||
%chatPosition = getWord(%this.extent, 1) - %chatScrollHeight + getWord(%this.position, 1);
|
||||
%linesToScroll = mFloor((%chatPosition / %textHeight) + 0.5);
|
||||
if (%linesToScroll <= 0)
|
||||
return;
|
||||
|
||||
if (%linesToScroll > %pageLines)
|
||||
%scrollLines = %pageLines;
|
||||
else
|
||||
%scrollLines = %linesToScroll;
|
||||
|
||||
// Now set the position
|
||||
%this.position = firstWord(%this.position) SPC (getWord(%this.position, 1) - (%scrollLines * %textHeight));
|
||||
|
||||
// See if we have should (still) display the pagedown icon
|
||||
if (%scrollLines < %linesToScroll)
|
||||
chatPageDown.setVisible(true);
|
||||
else
|
||||
chatPageDown.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Support functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function pageUpMessageHud()
|
||||
{
|
||||
ChatHud.pageUp();
|
||||
}
|
||||
|
||||
function pageDownMessageHud()
|
||||
{
|
||||
ChatHud.pageDown();
|
||||
}
|
||||
|
||||
function cycleMessageHudSize()
|
||||
{
|
||||
MainChatHud.nextChatHudLen();
|
||||
}
|
30
example/starter.racing/client/scripts/client.cs
Executable file
@ -0,0 +1,30 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Server Admin Commands
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function SAD(%password)
|
||||
{
|
||||
if (%password !$= "")
|
||||
commandToServer('SAD', %password);
|
||||
}
|
||||
|
||||
function SADSetPassword(%password)
|
||||
{
|
||||
commandToServer('SADSetPassword', %password);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Misc server commands
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function clientCmdSyncClock(%time)
|
||||
{
|
||||
// Time update from the server, this is only sent at the start of a mission
|
||||
// or when a client joins a game in progress.
|
||||
}
|
||||
|
373
example/starter.racing/client/scripts/default.bind.cs
Executable file
@ -0,0 +1,373 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
if ( isObject( moveMap ) )
|
||||
moveMap.delete();
|
||||
new ActionMap(moveMap);
|
||||
|
||||
if ( isObject( racingMap ) )
|
||||
racingMap.delete();
|
||||
new ActionMap(racingMap);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Non-remapable binds
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function escapeFromGame()
|
||||
{
|
||||
if ( $Server::ServerType $= "SinglePlayer" )
|
||||
MessageBoxYesNo( "Quit Mission", "Exit from this Mission?", "disconnect();", "");
|
||||
else
|
||||
MessageBoxYesNo( "Disconnect", "Disconnect from the server?", "disconnect();", "");
|
||||
}
|
||||
|
||||
moveMap.bindCmd(keyboard, "escape", "", "escapeFromGame();");
|
||||
|
||||
function showPlayerList(%val)
|
||||
{
|
||||
if (%val)
|
||||
PlayerListGui.toggle();
|
||||
}
|
||||
|
||||
moveMap.bind( keyboard, F2, showPlayerList );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Movement Keys
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
$movementSpeed = 1; // m/s
|
||||
|
||||
function setSpeed(%speed)
|
||||
{
|
||||
if(%speed)
|
||||
$movementSpeed = %speed;
|
||||
}
|
||||
|
||||
function moveleft(%val)
|
||||
{
|
||||
$mvLeftAction = %val * $movementSpeed;
|
||||
}
|
||||
|
||||
function moveright(%val)
|
||||
{
|
||||
$mvRightAction = %val * $movementSpeed;
|
||||
}
|
||||
|
||||
function moveup(%val)
|
||||
{
|
||||
$mvUpAction = %val * $movementSpeed;
|
||||
}
|
||||
|
||||
function movedown(%val)
|
||||
{
|
||||
$mvDownAction = %val * $movementSpeed;
|
||||
}
|
||||
|
||||
function accelerate(%val)
|
||||
{
|
||||
$mvForwardAction = %val * $movementSpeed;
|
||||
}
|
||||
|
||||
function brake(%val)
|
||||
{
|
||||
$mvBackwardAction = %val * $movementSpeed;
|
||||
}
|
||||
|
||||
function turnLeft( %val )
|
||||
{
|
||||
$mvYawRightSpeed = %val ? $Pref::Input::KeyboardTurnSpeed : 0;
|
||||
}
|
||||
|
||||
function turnRight( %val )
|
||||
{
|
||||
$mvYawLeftSpeed = %val ? $Pref::Input::KeyboardTurnSpeed : 0;
|
||||
}
|
||||
|
||||
function panUp( %val )
|
||||
{
|
||||
$mvPitchDownSpeed = %val ? $Pref::Input::KeyboardTurnSpeed : 0;
|
||||
}
|
||||
|
||||
function panDown( %val )
|
||||
{
|
||||
$mvPitchUpSpeed = %val ? $Pref::Input::KeyboardTurnSpeed : 0;
|
||||
}
|
||||
|
||||
function getMouseAdjustAmount(%val)
|
||||
{
|
||||
// based on a default camera fov of 90'
|
||||
return(%val * ($cameraFov / 90) * 0.01);
|
||||
}
|
||||
|
||||
function yaw(%val)
|
||||
{
|
||||
$mvYaw += getMouseAdjustAmount(%val);
|
||||
}
|
||||
|
||||
function pitch(%val)
|
||||
{
|
||||
$mvPitch += getMouseAdjustAmount(%val);
|
||||
}
|
||||
|
||||
function handbrake(%val)
|
||||
{
|
||||
$mvTriggerCount2++;
|
||||
}
|
||||
|
||||
racingMap.bind( keyboard, a, turnleft );
|
||||
racingMap.bind( keyboard, d, turnright );
|
||||
racingMap.bind( keyboard, left, turnleft );
|
||||
racingMap.bind( keyboard, right, turnright );
|
||||
|
||||
moveMap.bind( keyboard, a, moveleft );
|
||||
moveMap.bind( keyboard, d, moveright );
|
||||
moveMap.bind( keyboard, left, moveleft );
|
||||
moveMap.bind( keyboard, right, moveright );
|
||||
|
||||
moveMap.bind( keyboard, w, accelerate );
|
||||
moveMap.bind( keyboard, s, brake );
|
||||
moveMap.bind( keyboard, up, accelerate );
|
||||
moveMap.bind( keyboard, down, brake );
|
||||
|
||||
moveMap.bind( keyboard, space, handbrake );
|
||||
moveMap.bind( mouse, xaxis, yaw );
|
||||
moveMap.bind( mouse, yaxis, pitch );
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Mouse Trigger
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function mouseFire(%val)
|
||||
{
|
||||
$mvTriggerCount0++;
|
||||
}
|
||||
|
||||
function altTrigger(%val)
|
||||
{
|
||||
$mvTriggerCount1++;
|
||||
}
|
||||
|
||||
moveMap.bind( mouse, button0, mouseFire );
|
||||
//moveMap.bind( mouse, button1, altTrigger );
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Zoom and FOV functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
if($Pref::player::CurrentFOV $= "")
|
||||
$Pref::player::CurrentFOV = 45;
|
||||
|
||||
function setZoomFOV(%val)
|
||||
{
|
||||
if(%val)
|
||||
toggleZoomFOV();
|
||||
}
|
||||
|
||||
function toggleZoom( %val )
|
||||
{
|
||||
if ( %val )
|
||||
{
|
||||
$ZoomOn = true;
|
||||
setFov( $Pref::player::CurrentFOV );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ZoomOn = false;
|
||||
setFov( $Pref::player::DefaultFov );
|
||||
}
|
||||
}
|
||||
|
||||
moveMap.bind(keyboard, r, setZoomFOV);
|
||||
moveMap.bind(keyboard, e, toggleZoom);
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Camera & View functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function toggleFreeLook( %val )
|
||||
{
|
||||
if ( %val )
|
||||
$mvFreeLook = true;
|
||||
else
|
||||
$mvFreeLook = false;
|
||||
}
|
||||
|
||||
$firstPerson = true;
|
||||
function toggleFirstPerson(%val)
|
||||
{
|
||||
if (%val)
|
||||
{
|
||||
$firstPerson = !$firstPerson;
|
||||
ServerConnection.setFirstPerson($firstPerson);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleCamera(%val)
|
||||
{
|
||||
if (%val)
|
||||
{
|
||||
// Since we want the free cam to strafe but the WheeledVehicle
|
||||
// to turn we need to do a little ActionMap wizardry
|
||||
%control = ServerConnection.getControlObject();
|
||||
if (%control.getClassName() $= "Camera")
|
||||
racingMap.push();
|
||||
else
|
||||
racingMap.pop();
|
||||
|
||||
commandToServer('ToggleCamera');
|
||||
}
|
||||
}
|
||||
|
||||
moveMap.bind( keyboard, z, toggleFreeLook );
|
||||
moveMap.bind(keyboard, tab, toggleFirstPerson );
|
||||
moveMap.bind(keyboard, "alt c", toggleCamera);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Misc. Player stuff
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
moveMap.bindCmd(keyboard, "ctrl r", "commandToServer('reset');", "");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Item manipulation
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
moveMap.bindCmd(keyboard, "h", "commandToServer('use',\"HealthKit\");", "");
|
||||
moveMap.bindCmd(keyboard, "1", "commandToServer('use',\"Rifle\");", "");
|
||||
moveMap.bindCmd(keyboard, "2", "commandToServer('use',\"Crossbow\");", "");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Message HUD functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function pageMessageHudUp( %val )
|
||||
{
|
||||
if ( %val )
|
||||
pageUpMessageHud();
|
||||
}
|
||||
|
||||
function pageMessageHudDown( %val )
|
||||
{
|
||||
if ( %val )
|
||||
pageDownMessageHud();
|
||||
}
|
||||
|
||||
function resizeMessageHud( %val )
|
||||
{
|
||||
if ( %val )
|
||||
cycleMessageHudSize();
|
||||
}
|
||||
|
||||
moveMap.bind(keyboard, u, toggleMessageHud );
|
||||
//moveMap.bind(keyboard, y, teamMessageHud );
|
||||
moveMap.bind(keyboard, "pageUp", pageMessageHudUp );
|
||||
moveMap.bind(keyboard, "pageDown", pageMessageHudDown );
|
||||
moveMap.bind(keyboard, "p", resizeMessageHud );
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Demo recording functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function startRecordingDemo( %val )
|
||||
{
|
||||
if ( %val )
|
||||
startDemoRecord();
|
||||
}
|
||||
|
||||
function stopRecordingDemo( %val )
|
||||
{
|
||||
if ( %val )
|
||||
stopDemoRecord();
|
||||
}
|
||||
|
||||
moveMap.bind( keyboard, F3, startRecordingDemo );
|
||||
moveMap.bind( keyboard, F4, stopRecordingDemo );
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helper Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function dropCameraAtPlayer(%val)
|
||||
{
|
||||
if (%val)
|
||||
commandToServer('dropCameraAtPlayer');
|
||||
}
|
||||
|
||||
function dropPlayerAtCamera(%val)
|
||||
{
|
||||
if (%val)
|
||||
commandToServer('DropPlayerAtCamera');
|
||||
}
|
||||
|
||||
moveMap.bind(keyboard, "F8", dropCameraAtPlayer);
|
||||
moveMap.bind(keyboard, "F7", dropPlayerAtCamera);
|
||||
|
||||
function bringUpOptions(%val)
|
||||
{
|
||||
if (%val)
|
||||
Canvas.pushDialog(OptionsDlg);
|
||||
}
|
||||
|
||||
moveMap.bind(keyboard, "ctrl o", bringUpOptions);
|
||||
moveMap.bindCmd(keyboard, "n", "NetGraph::toggleNetGraph();", "");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Dubuging Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
$MFDebugRenderMode = 0;
|
||||
function cycleDebugRenderMode(%val)
|
||||
{
|
||||
if (!%val)
|
||||
return;
|
||||
|
||||
if (getBuildString() $= "Debug")
|
||||
{
|
||||
if($MFDebugRenderMode == 0)
|
||||
{
|
||||
// Outline mode, including fonts so no stats
|
||||
$MFDebugRenderMode = 1;
|
||||
GLEnableOutline(true);
|
||||
}
|
||||
else if ($MFDebugRenderMode == 1)
|
||||
{
|
||||
// Interior debug mode
|
||||
$MFDebugRenderMode = 2;
|
||||
GLEnableOutline(false);
|
||||
setInteriorRenderMode(7);
|
||||
showInterior();
|
||||
}
|
||||
else if ($MFDebugRenderMode == 2)
|
||||
{
|
||||
// Back to normal
|
||||
$MFDebugRenderMode = 0;
|
||||
setInteriorRenderMode(0);
|
||||
GLEnableOutline(false);
|
||||
show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo("Debug render modes only available when running a Debug build.");
|
||||
}
|
||||
}
|
||||
|
||||
GlobalActionMap.bind(keyboard, "F9", cycleDebugRenderMode);
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Misc.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
GlobalActionMap.bind(keyboard, "tilde", toggleConsole);
|
||||
GlobalActionMap.bindCmd(keyboard, "alt k", "cls();","");
|
||||
GlobalActionMap.bindCmd(keyboard, "alt enter", "", "toggleFullScreen();");
|
||||
GlobalActionMap.bindCmd(keyboard, "F1", "", "contextHelp();");
|
||||
|
46
example/starter.racing/client/scripts/game.cs
Executable file
@ -0,0 +1,46 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Game start / end events sent from the server
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function clientCmdSetCounter(%count)
|
||||
{
|
||||
if(%count == 3)
|
||||
counter.setVisible(true);
|
||||
|
||||
counter.setBitmap("starter.racing/client/ui/" @ %count @ ".png");
|
||||
|
||||
alxPlay(AudioCountBeep);
|
||||
}
|
||||
|
||||
function clientCmdGameStart(%seq)
|
||||
{
|
||||
// Display the GO bitmap and play a sound
|
||||
counter.setBitmap("starter.racing/client/ui/go.png");
|
||||
alxPlay(AudioGoBeep);
|
||||
// Remove the GO after a second.
|
||||
counter.schedule(1000, setVisible, false);
|
||||
}
|
||||
|
||||
function clientCmdGameEnd(%seq)
|
||||
{
|
||||
// Stop local activity... the game will be destroyed on the server
|
||||
alxStopAll();
|
||||
|
||||
// Copy the current scores from the player list into the
|
||||
// end game gui (bit of a hack for now).
|
||||
EndGameGuiList.clear();
|
||||
for (%i = 0; %i < PlayerListGuiList.rowCount(); %i++) {
|
||||
%text = PlayerListGuiList.getRowText(%i);
|
||||
%id = PlayerListGuiList.getRowId(%i);
|
||||
EndGameGuiList.addRow(%id,%text);
|
||||
}
|
||||
EndGameGuiList.sortNumerical(1,false);
|
||||
|
||||
// Display the end-game screen
|
||||
Canvas.setContent(EndGameGui);
|
||||
}
|
36
example/starter.racing/client/scripts/loadingGui.cs
Executable file
@ -0,0 +1,36 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LoadingGui::onAdd(%this)
|
||||
{
|
||||
%this.qLineCount = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LoadingGui::onWake(%this)
|
||||
{
|
||||
// Play sound...
|
||||
CloseMessagePopup();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LoadingGui::onSleep(%this)
|
||||
{
|
||||
// Clear the load info:
|
||||
if ( %this.qLineCount !$= "" )
|
||||
{
|
||||
for ( %line = 0; %line < %this.qLineCount; %line++ )
|
||||
%this.qLine[%line] = "";
|
||||
}
|
||||
%this.qLineCount = 0;
|
||||
|
||||
LOAD_MapName.setText( "" );
|
||||
LOAD_MapDescription.setText( "" );
|
||||
LoadingProgress.setValue( 0 );
|
||||
LoadingProgressTxt.setValue( "WAITING FOR SERVER" );
|
||||
|
||||
// Stop sound...
|
||||
}
|
112
example/starter.racing/client/scripts/messageHud.cs
Executable file
@ -0,0 +1,112 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Enter Chat Message Hud
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MessageHud::open(%this)
|
||||
{
|
||||
%offset = 6;
|
||||
|
||||
if(%this.isVisible())
|
||||
return;
|
||||
|
||||
if(%this.isTeamMsg)
|
||||
%text = "TEAM:";
|
||||
else
|
||||
%text = "GLOBAL:";
|
||||
|
||||
MessageHud_Text.setValue(%text);
|
||||
|
||||
%windowPos = "0 " @ ( getWord( outerChatHud.position, 1 ) + getWord( outerChatHud.extent, 1 ) + 1 );
|
||||
%windowExt = getWord( OuterChatHud.extent, 0 ) @ " " @ getWord( MessageHud_Frame.extent, 1 );
|
||||
|
||||
%textExtent = getWord(MessageHud_Text.extent, 0) + 14;
|
||||
%ctrlExtent = getWord(MessageHud_Frame.extent, 0);
|
||||
|
||||
Canvas.pushDialog(%this);
|
||||
|
||||
messageHud_Frame.position = %windowPos;
|
||||
messageHud_Frame.extent = %windowExt;
|
||||
MessageHud_Edit.position = setWord(MessageHud_Edit.position, 0, %textExtent + %offset);
|
||||
MessageHud_Edit.extent = setWord(MessageHud_Edit.extent, 0, %ctrlExtent - %textExtent - (2 * %offset));
|
||||
|
||||
%this.setVisible(true);
|
||||
deactivateKeyboard();
|
||||
MessageHud_Edit.makeFirstResponder(true);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MessageHud::close(%this)
|
||||
{
|
||||
if(!%this.isVisible())
|
||||
return;
|
||||
|
||||
Canvas.popDialog(%this);
|
||||
%this.setVisible(false);
|
||||
if ( $enableDirectInput )
|
||||
activateKeyboard();
|
||||
MessageHud_Edit.setValue("");
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MessageHud::toggleState(%this)
|
||||
{
|
||||
if(%this.isVisible())
|
||||
%this.close();
|
||||
else
|
||||
%this.open();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MessageHud_Edit::onEscape(%this)
|
||||
{
|
||||
MessageHud.close();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MessageHud_Edit::eval(%this)
|
||||
{
|
||||
%text = trim(%this.getValue());
|
||||
if(%text !$= "")
|
||||
{
|
||||
if(MessageHud.isTeamMsg)
|
||||
commandToServer('teamMessageSent', %text);
|
||||
else
|
||||
commandToServer('messageSent', %text);
|
||||
}
|
||||
|
||||
MessageHud.close();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// MessageHud key handlers
|
||||
|
||||
function toggleMessageHud(%make)
|
||||
{
|
||||
if(%make)
|
||||
{
|
||||
MessageHud.isTeamMsg = false;
|
||||
MessageHud.toggleState();
|
||||
}
|
||||
}
|
||||
|
||||
function teamMessageHud(%make)
|
||||
{
|
||||
if(%make)
|
||||
{
|
||||
MessageHud.isTeamMsg = true;
|
||||
MessageHud.toggleState();
|
||||
}
|
||||
}
|
153
example/starter.racing/client/scripts/missionDownload.cs
Executable file
@ -0,0 +1,153 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Mission Loading & Mission Info
|
||||
// The mission loading server handshaking is handled by the
|
||||
// common/client/missingLoading.cs. This portion handles the interface
|
||||
// with the game GUI.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Loading Phases:
|
||||
// Phase 1: Download Datablocks
|
||||
// Phase 2: Download Ghost Objects
|
||||
// Phase 3: Scene Lighting
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Phase 1
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function onMissionDownloadPhase1(%missionName, %musicTrack)
|
||||
{
|
||||
// Close and clear the message hud (in case it's open)
|
||||
MessageHud.close();
|
||||
//cls();
|
||||
|
||||
// Reset the loading progress controls:
|
||||
LoadingProgress.setValue(0);
|
||||
LoadingProgressTxt.setValue("LOADING DATABLOCKS");
|
||||
}
|
||||
|
||||
function onPhase1Progress(%progress)
|
||||
{
|
||||
LoadingProgress.setValue(%progress);
|
||||
Canvas.repaint();
|
||||
}
|
||||
|
||||
function onPhase1Complete()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Phase 2
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function onMissionDownloadPhase2()
|
||||
{
|
||||
// Reset the loading progress controls:
|
||||
LoadingProgress.setValue(0);
|
||||
LoadingProgressTxt.setValue("LOADING OBJECTS");
|
||||
Canvas.repaint();
|
||||
}
|
||||
|
||||
function onPhase2Progress(%progress)
|
||||
{
|
||||
LoadingProgress.setValue(%progress);
|
||||
Canvas.repaint();
|
||||
}
|
||||
|
||||
function onPhase2Complete()
|
||||
{
|
||||
}
|
||||
|
||||
function onFileChunkReceived(%fileName, %ofs, %size)
|
||||
{
|
||||
LoadingProgress.setValue(%ofs / %size);
|
||||
LoadingProgressTxt.setValue("Downloading " @ %fileName @ "...");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Phase 3
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function onMissionDownloadPhase3()
|
||||
{
|
||||
LoadingProgress.setValue(0);
|
||||
LoadingProgressTxt.setValue("LIGHTING MISSION");
|
||||
Canvas.repaint();
|
||||
}
|
||||
|
||||
function onPhase3Progress(%progress)
|
||||
{
|
||||
LoadingProgress.setValue(%progress);
|
||||
}
|
||||
|
||||
function onPhase3Complete()
|
||||
{
|
||||
LoadingProgress.setValue( 1 );
|
||||
$lightingMission = false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Mission loading done!
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function onMissionDownloadComplete()
|
||||
{
|
||||
// Client will shortly be dropped into the game, so this is
|
||||
// good place for any last minute gui cleanup.
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Before downloading a mission, the server transmits the mission
|
||||
// information through these messages.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
addMessageCallback( 'MsgLoadInfo', handleLoadInfoMessage );
|
||||
addMessageCallback( 'MsgLoadDescripition', handleLoadDescriptionMessage );
|
||||
addMessageCallback( 'MsgLoadInfoDone', handleLoadInfoDoneMessage );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function handleLoadInfoMessage( %msgType, %msgString, %mapName ) {
|
||||
|
||||
// Need to pop up the loading gui to display this stuff.
|
||||
Canvas.setContent("LoadingGui");
|
||||
|
||||
// Clear all of the loading info lines:
|
||||
for( %line = 0; %line < LoadingGui.qLineCount; %line++ )
|
||||
LoadingGui.qLine[%line] = "";
|
||||
LoadingGui.qLineCount = 0;
|
||||
|
||||
//
|
||||
LOAD_MapName.setText( %mapName );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function handleLoadDescriptionMessage( %msgType, %msgString, %line )
|
||||
{
|
||||
LoadingGui.qLine[LoadingGui.qLineCount] = %line;
|
||||
LoadingGui.qLineCount++;
|
||||
|
||||
// Gather up all the previous lines, append the current one
|
||||
// and stuff it into the control
|
||||
%text = "<spush><font:Arial:16>";
|
||||
|
||||
for( %line = 0; %line < LoadingGui.qLineCount - 1; %line++ )
|
||||
%text = %text @ LoadingGui.qLine[%line] @ " ";
|
||||
%text = %text @ LoadingGui.qLine[%line] @ "<spop>";
|
||||
|
||||
LOAD_MapDescription.setText( %text );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function handleLoadInfoDoneMessage( %msgType, %msgString )
|
||||
{
|
||||
// This will get called after the last description line is sent.
|
||||
}
|
603
example/starter.racing/client/scripts/optionsDlg.cs
Executable file
@ -0,0 +1,603 @@
|
||||
function optionsDlg::setPane(%this, %pane)
|
||||
{
|
||||
OptAudioPane.setVisible(false);
|
||||
OptGraphicsPane.setVisible(false);
|
||||
OptNetworkPane.setVisible(false);
|
||||
OptControlsPane.setVisible(false);
|
||||
("Opt" @ %pane @ "Pane").setVisible(true);
|
||||
OptRemapList.fillList();
|
||||
}
|
||||
|
||||
function OptionsDlg::onWake(%this)
|
||||
{
|
||||
OptGraphicsButton.performClick();
|
||||
%buffer = getDisplayDeviceList();
|
||||
%count = getFieldCount( %buffer );
|
||||
OptGraphicsDriverMenu.clear();
|
||||
OptScreenshotMenu.init();
|
||||
OptScreenshotMenu.setValue($pref::Video::screenShotFormat);
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
OptGraphicsDriverMenu.add(getField(%buffer, %i), %i);
|
||||
%selId = OptGraphicsDriverMenu.findText( $pref::Video::displayDevice );
|
||||
if ( %selId == -1 )
|
||||
%selId = 0; // How did THAT happen?
|
||||
OptGraphicsDriverMenu.setSelected( %selId );
|
||||
OptGraphicsDriverMenu.onSelect( %selId, "" );
|
||||
|
||||
// Audio
|
||||
OptAudioUpdate();
|
||||
OptAudioVolumeMaster.setValue($pref::Audio::masterVolume);
|
||||
OptAudioVolumeShell.setValue( $pref::Audio::channelVolume[$GuiAudioType]);
|
||||
OptAudioVolumeSim.setValue( $pref::Audio::channelVolume[$SimAudioType]);
|
||||
OptAudioDriverList.clear();
|
||||
OptAudioDriverList.add("OpenAL", 1);
|
||||
OptAudioDriverList.add("none", 2);
|
||||
%selId = OptAudioDriverList.findText($pref::Audio::driver);
|
||||
if ( %selId == -1 )
|
||||
%selId = 0; // How did THAT happen?
|
||||
OptAudioDriverList.setSelected( %selId );
|
||||
OptAudioDriverList.onSelect( %selId, "" );
|
||||
}
|
||||
|
||||
function OptionsDlg::onSleep(%this)
|
||||
{
|
||||
// write out the control config into the rw/config.cs file
|
||||
moveMap.save( "./client/config.cs" );
|
||||
}
|
||||
|
||||
function OptGraphicsDriverMenu::onSelect( %this, %id, %text )
|
||||
{
|
||||
// Attempt to keep the same res and bpp settings:
|
||||
if ( OptGraphicsResolutionMenu.size() > 0 )
|
||||
%prevRes = OptGraphicsResolutionMenu.getText();
|
||||
else
|
||||
%prevRes = getWords( $pref::Video::resolution, 0, 1 );
|
||||
|
||||
// Check if this device is full-screen only:
|
||||
if ( isDeviceFullScreenOnly( %this.getText() ) )
|
||||
{
|
||||
OptGraphicsFullscreenToggle.setValue( true );
|
||||
OptGraphicsFullscreenToggle.setActive( false );
|
||||
OptGraphicsFullscreenToggle.onAction();
|
||||
}
|
||||
else
|
||||
OptGraphicsFullscreenToggle.setActive( true );
|
||||
|
||||
if ( OptGraphicsFullscreenToggle.getValue() )
|
||||
{
|
||||
if ( OptGraphicsBPPMenu.size() > 0 )
|
||||
%prevBPP = OptGraphicsBPPMenu.getText();
|
||||
else
|
||||
%prevBPP = getWord( $pref::Video::resolution, 2 );
|
||||
}
|
||||
|
||||
// Fill the resolution and bit depth lists:
|
||||
OptGraphicsResolutionMenu.init( %this.getText(), OptGraphicsFullscreenToggle.getValue() );
|
||||
OptGraphicsBPPMenu.init( %this.getText() );
|
||||
|
||||
// Try to select the previous settings:
|
||||
%selId = OptGraphicsResolutionMenu.findText( %prevRes );
|
||||
if ( %selId == -1 )
|
||||
%selId = 0;
|
||||
OptGraphicsResolutionMenu.setSelected( %selId );
|
||||
|
||||
if ( OptGraphicsFullscreenToggle.getValue() )
|
||||
{
|
||||
%selId = OptGraphicsBPPMenu.findText( %prevBPP );
|
||||
if ( %selId == -1 )
|
||||
%selId = 0;
|
||||
OptGraphicsBPPMenu.setSelected( %selId );
|
||||
OptGraphicsBPPMenu.setText( OptGraphicsBPPMenu.getTextById( %selId ) );
|
||||
}
|
||||
else
|
||||
OptGraphicsBPPMenu.setText( "Default" );
|
||||
|
||||
}
|
||||
|
||||
function OptGraphicsResolutionMenu::init( %this, %device, %fullScreen )
|
||||
{
|
||||
%this.clear();
|
||||
%resList = getResolutionList( %device );
|
||||
%resCount = getFieldCount( %resList );
|
||||
%deskRes = getDesktopResolution();
|
||||
|
||||
%count = 0;
|
||||
for ( %i = 0; %i < %resCount; %i++ )
|
||||
{
|
||||
%res = getWords( getField( %resList, %i ), 0, 1 );
|
||||
|
||||
if ( !%fullScreen )
|
||||
{
|
||||
if ( firstWord( %res ) >= firstWord( %deskRes ) )
|
||||
continue;
|
||||
if ( getWord( %res, 1 ) >= getWord( %deskRes, 1 ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only add to list if it isn't there already:
|
||||
if ( %this.findText( %res ) == -1 )
|
||||
{
|
||||
%this.add( %res, %count );
|
||||
%count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function OptGraphicsFullscreenToggle::onAction(%this)
|
||||
{
|
||||
Parent::onAction();
|
||||
%prevRes = OptGraphicsResolutionMenu.getText();
|
||||
|
||||
// Update the resolution menu with the new options
|
||||
OptGraphicsResolutionMenu.init( OptGraphicsDriverMenu.getText(), %this.getValue() );
|
||||
|
||||
// Set it back to the previous resolution if the new mode supports it.
|
||||
%selId = OptGraphicsResolutionMenu.findText( %prevRes );
|
||||
if ( %selId == -1 )
|
||||
%selId = 0;
|
||||
OptGraphicsResolutionMenu.setSelected( %selId );
|
||||
}
|
||||
|
||||
|
||||
function OptGraphicsBPPMenu::init( %this, %device )
|
||||
{
|
||||
%this.clear();
|
||||
|
||||
if ( %device $= "Voodoo2" )
|
||||
%this.add( "16", 0 );
|
||||
else
|
||||
{
|
||||
%resList = getResolutionList( %device );
|
||||
%resCount = getFieldCount( %resList );
|
||||
%count = 0;
|
||||
for ( %i = 0; %i < %resCount; %i++ )
|
||||
{
|
||||
%bpp = getWord( getField( %resList, %i ), 2 );
|
||||
|
||||
// Only add to list if it isn't there already:
|
||||
if ( %this.findText( %bpp ) == -1 )
|
||||
{
|
||||
%this.add( %bpp, %count );
|
||||
%count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function OptScreenshotMenu::init( %this )
|
||||
{
|
||||
if( %this.findText("PNG") == -1 )
|
||||
%this.add("PNG", 0);
|
||||
if( %this.findText("JPEG") == - 1 )
|
||||
%this.add("JPEG", 1);
|
||||
}
|
||||
|
||||
function optionsDlg::applyGraphics( %this )
|
||||
{
|
||||
%newDriver = OptGraphicsDriverMenu.getText();
|
||||
%newRes = OptGraphicsResolutionMenu.getText();
|
||||
%newBpp = OptGraphicsBPPMenu.getText();
|
||||
%newFullScreen = OptGraphicsFullscreenToggle.getValue();
|
||||
$pref::Video::screenShotFormat = OptScreenshotMenu.getText();
|
||||
|
||||
if ( %newDriver !$= $pref::Video::displayDevice )
|
||||
{
|
||||
setDisplayDevice( %newDriver, firstWord( %newRes ), getWord( %newRes, 1 ), %newBpp, %newFullScreen );
|
||||
//OptionsDlg::deviceDependent( %this );
|
||||
}
|
||||
else
|
||||
setScreenMode( firstWord( %newRes ), getWord( %newRes, 1 ), %newBpp, %newFullScreen );
|
||||
}
|
||||
|
||||
|
||||
|
||||
$RemapCount = 0;
|
||||
$RemapName[$RemapCount] = "Accelerate";
|
||||
$RemapCmd[$RemapCount] = "accelerate";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Brake/Reverse";
|
||||
$RemapCmd[$RemapCount] = "brake";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Turn Left";
|
||||
$RemapCmd[$RemapCount] = "turnLeft";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Turn Right";
|
||||
$RemapCmd[$RemapCount] = "turnRight";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Hand brake";
|
||||
$RemapCmd[$RemapCount] = "handbrake";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Adjust Zoom";
|
||||
$RemapCmd[$RemapCount] = "setZoomFov";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Toggle Zoom";
|
||||
$RemapCmd[$RemapCount] = "toggleZoom";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Free Look";
|
||||
$RemapCmd[$RemapCount] = "toggleFreeLook";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Switch 1st/3rd";
|
||||
$RemapCmd[$RemapCount] = "toggleFirstPerson";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Chat to Everyone";
|
||||
$RemapCmd[$RemapCount] = "toggleMessageHud";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Message Hud PageUp";
|
||||
$RemapCmd[$RemapCount] = "pageMessageHudUp";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Message Hud PageDown";
|
||||
$RemapCmd[$RemapCount] = "pageMessageHudDown";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Resize Message Hud";
|
||||
$RemapCmd[$RemapCount] = "resizeMessageHud";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Show Scores";
|
||||
$RemapCmd[$RemapCount] = "showPlayerList";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Reset car";
|
||||
$RemapCmd[$RemapCount] = "reset";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Toggle Camera";
|
||||
$RemapCmd[$RemapCount] = "toggleCamera";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Drop Camera at Player";
|
||||
$RemapCmd[$RemapCount] = "dropCameraAtPlayer";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Drop Player at Camera";
|
||||
$RemapCmd[$RemapCount] = "dropPlayerAtCamera";
|
||||
$RemapCount++;
|
||||
$RemapName[$RemapCount] = "Bring up Options Dialog";
|
||||
$RemapCmd[$RemapCount] = "bringUpOptions";
|
||||
$RemapCount++;
|
||||
|
||||
|
||||
function restoreDefaultMappings()
|
||||
{
|
||||
moveMap.delete();
|
||||
exec( "~/scripts/default.bind.cs" );
|
||||
OptRemapList.fillList();
|
||||
}
|
||||
|
||||
function getMapDisplayName( %device, %action )
|
||||
{
|
||||
if ( %device $= "keyboard" )
|
||||
return( %action );
|
||||
else if ( strstr( %device, "mouse" ) != -1 )
|
||||
{
|
||||
// Substitute "mouse" for "button" in the action string:
|
||||
%pos = strstr( %action, "button" );
|
||||
if ( %pos != -1 )
|
||||
{
|
||||
%mods = getSubStr( %action, 0, %pos );
|
||||
%object = getSubStr( %action, %pos, 1000 );
|
||||
%instance = getSubStr( %object, strlen( "button" ), 1000 );
|
||||
return( %mods @ "mouse" @ ( %instance + 1 ) );
|
||||
}
|
||||
else
|
||||
error( "Mouse input object other than button passed to getDisplayMapName!" );
|
||||
}
|
||||
else if ( strstr( %device, "joystick" ) != -1 )
|
||||
{
|
||||
// Substitute "joystick" for "button" in the action string:
|
||||
%pos = strstr( %action, "button" );
|
||||
if ( %pos != -1 )
|
||||
{
|
||||
%mods = getSubStr( %action, 0, %pos );
|
||||
%object = getSubStr( %action, %pos, 1000 );
|
||||
%instance = getSubStr( %object, strlen( "button" ), 1000 );
|
||||
return( %mods @ "joystick" @ ( %instance + 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
%pos = strstr( %action, "pov" );
|
||||
if ( %pos != -1 )
|
||||
{
|
||||
%wordCount = getWordCount( %action );
|
||||
%mods = %wordCount > 1 ? getWords( %action, 0, %wordCount - 2 ) @ " " : "";
|
||||
%object = getWord( %action, %wordCount - 1 );
|
||||
switch$ ( %object )
|
||||
{
|
||||
case "upov": %object = "POV1 up";
|
||||
case "dpov": %object = "POV1 down";
|
||||
case "lpov": %object = "POV1 left";
|
||||
case "rpov": %object = "POV1 right";
|
||||
case "upov2": %object = "POV2 up";
|
||||
case "dpov2": %object = "POV2 down";
|
||||
case "lpov2": %object = "POV2 left";
|
||||
case "rpov2": %object = "POV2 right";
|
||||
default: %object = "??";
|
||||
}
|
||||
return( %mods @ %object );
|
||||
}
|
||||
else
|
||||
error( "Unsupported Joystick input object passed to getDisplayMapName!" );
|
||||
}
|
||||
}
|
||||
|
||||
return( "??" );
|
||||
}
|
||||
|
||||
function buildFullMapString( %index )
|
||||
{
|
||||
%name = $RemapName[%index];
|
||||
%cmd = $RemapCmd[%index];
|
||||
|
||||
%temp = moveMap.getBinding( %cmd );
|
||||
if ( %temp $= "" )
|
||||
return %name TAB "";
|
||||
|
||||
%mapString = "";
|
||||
|
||||
%count = getFieldCount( %temp );
|
||||
for ( %i = 0; %i < %count; %i += 2 )
|
||||
{
|
||||
if ( %mapString !$= "" )
|
||||
%mapString = %mapString @ ", ";
|
||||
|
||||
%device = getField( %temp, %i + 0 );
|
||||
%object = getField( %temp, %i + 1 );
|
||||
%mapString = %mapString @ getMapDisplayName( %device, %object );
|
||||
}
|
||||
|
||||
return %name TAB %mapString;
|
||||
}
|
||||
|
||||
function OptRemapList::fillList( %this )
|
||||
{
|
||||
%this.clear();
|
||||
for ( %i = 0; %i < $RemapCount; %i++ )
|
||||
%this.addRow( %i, buildFullMapString( %i ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function OptRemapList::doRemap( %this )
|
||||
{
|
||||
%selId = %this.getSelectedId();
|
||||
%name = $RemapName[%selId];
|
||||
|
||||
OptRemapText.setValue( "REMAP \"" @ %name @ "\"" );
|
||||
OptRemapInputCtrl.index = %selId;
|
||||
Canvas.pushDialog( RemapDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function redoMapping( %device, %action, %cmd, %oldIndex, %newIndex )
|
||||
{
|
||||
//%actionMap.bind( %device, %action, $RemapCmd[%newIndex] );
|
||||
moveMap.bind( %device, %action, %cmd );
|
||||
OptRemapList.setRowById( %oldIndex, buildFullMapString( %oldIndex ) );
|
||||
OptRemapList.setRowById( %newIndex, buildFullMapString( %newIndex ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function findRemapCmdIndex( %command )
|
||||
{
|
||||
for ( %i = 0; %i < $RemapCount; %i++ )
|
||||
{
|
||||
if ( %command $= $RemapCmd[%i] )
|
||||
return( %i );
|
||||
}
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/// This unbinds actions beyond %count associated to the
|
||||
/// particular moveMap %commmand.
|
||||
function unbindExtraActions( %command, %count )
|
||||
{
|
||||
%temp = moveMap.getBinding( %command );
|
||||
if ( %temp $= "" )
|
||||
return;
|
||||
|
||||
%count = getFieldCount( %temp ) - ( %count * 2 );
|
||||
for ( %i = 0; %i < %count; %i += 2 )
|
||||
{
|
||||
%device = getField( %temp, %i + 0 );
|
||||
%action = getField( %temp, %i + 1 );
|
||||
|
||||
moveMap.unbind( %device, %action );
|
||||
}
|
||||
}
|
||||
|
||||
function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
|
||||
{
|
||||
//error( "** onInputEvent called - device = " @ %device @ ", action = " @ %action @ " **" );
|
||||
Canvas.popDialog( RemapDlg );
|
||||
|
||||
// Test for the reserved keystrokes:
|
||||
if ( %device $= "keyboard" )
|
||||
{
|
||||
// Cancel...
|
||||
if ( %action $= "escape" )
|
||||
{
|
||||
// Do nothing...
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
%cmd = $RemapCmd[%this.index];
|
||||
%name = $RemapName[%this.index];
|
||||
|
||||
// Grab the friendly display name for this action
|
||||
// which we'll use when prompting the user below.
|
||||
%mapName = getMapDisplayName( %device, %action );
|
||||
|
||||
// Get the current command this action is mapped to.
|
||||
%prevMap = moveMap.getCommand( %device, %action );
|
||||
|
||||
// If nothing was mapped to the previous command
|
||||
// mapping then it's easy... just bind it.
|
||||
if ( %prevMap $= "" )
|
||||
{
|
||||
unbindExtraActions( %cmd, 1 );
|
||||
moveMap.bind( %device, %action, %cmd );
|
||||
OptRemapList.setRowById( %this.index, buildFullMapString( %this.index ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// If the previous command is the same as the
|
||||
// current then they hit the same input as what
|
||||
// was already assigned.
|
||||
if ( %prevMap $= %cmd )
|
||||
{
|
||||
unbindExtraActions( %cmd, 0 );
|
||||
moveMap.bind( %device, %action, %cmd );
|
||||
OptRemapList.setRowById( %this.index, buildFullMapString( %this.index ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Look for the index of the previous mapping.
|
||||
%prevMapIndex = findRemapCmdIndex( %prevMap );
|
||||
|
||||
// If we get a negative index then the previous
|
||||
// mapping was to an item that isn't included in
|
||||
// the mapping list... so we cannot unmap it.
|
||||
if ( %prevMapIndex == -1 )
|
||||
{
|
||||
MessageBoxOK( "Remap Failed", "\"" @ %mapName @ "\" is already bound to a non-remappable command!" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup the forced remapping callback command.
|
||||
%callback = "redoMapping(" @ %device @ ", \"" @ %action @ "\", \"" @
|
||||
%cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");";
|
||||
|
||||
// Warn that we're about to remove the old mapping and
|
||||
// replace it with another.
|
||||
%prevCmdName = $RemapName[%prevMapIndex];
|
||||
MessageBoxYesNo( "Warning",
|
||||
"\"" @ %mapName @ "\" is already bound to \""
|
||||
@ %prevCmdName @ "\"!\nDo you wish to replace this mapping?",
|
||||
%callback, "" );
|
||||
}
|
||||
|
||||
// Audio
|
||||
function OptAudioUpdate()
|
||||
{
|
||||
// set the driver text
|
||||
%text = "Vendor: " @ alGetString("AL_VENDOR") @
|
||||
"\nVersion: " @ alGetString("AL_VERSION") @
|
||||
"\nRenderer: " @ alGetString("AL_RENDERER") @
|
||||
"\nExtensions: " @ alGetString("AL_EXTENSIONS");
|
||||
OptAudioInfo.setText(%text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Channel 0 is unused in-game, but is used here to test master volume.
|
||||
|
||||
new AudioDescription(AudioChannel0)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 0;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChannel1)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 1;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChannel2)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 2;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChannel3)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 3;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChannel4)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 4;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChannel5)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 5;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChannel6)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 6;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChannel7)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 7;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChannel8)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = 8;
|
||||
};
|
||||
|
||||
$AudioTestHandle = 0;
|
||||
|
||||
function OptAudioUpdateMasterVolume(%volume)
|
||||
{
|
||||
if (%volume == $pref::Audio::masterVolume)
|
||||
return;
|
||||
alxListenerf(AL_GAIN_LINEAR, %volume);
|
||||
$pref::Audio::masterVolume = %volume;
|
||||
if (!alxIsPlaying($AudioTestHandle))
|
||||
{
|
||||
$AudioTestHandle = alxCreateSource("AudioChannel0", expandFilename("~/data/sound/testing.wav"));
|
||||
alxPlay($AudioTestHandle);
|
||||
}
|
||||
}
|
||||
|
||||
function OptAudioUpdateChannelVolume(%channel, %volume)
|
||||
{
|
||||
if (%channel < 1 || %channel > 8)
|
||||
return;
|
||||
|
||||
if (%volume == $pref::Audio::channelVolume[%channel])
|
||||
return;
|
||||
|
||||
alxSetChannelVolume(%channel, %volume);
|
||||
$pref::Audio::channelVolume[%channel] = %volume;
|
||||
if (!alxIsPlaying($AudioTestHandle))
|
||||
{
|
||||
$AudioTestHandle = alxCreateSource("AudioChannel"@%channel, expandFilename("~/data/sound/testing.wav"));
|
||||
alxPlay($AudioTestHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function OptAudioDriverList::onSelect( %this, %id, %text )
|
||||
{
|
||||
if (%text $= "")
|
||||
return;
|
||||
|
||||
if ($pref::Audio::driver $= %text)
|
||||
return;
|
||||
|
||||
$pref::Audio::driver = %text;
|
||||
OpenALInit();
|
||||
}
|
74
example/starter.racing/client/scripts/playGui.cs
Executable file
@ -0,0 +1,74 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// PlayGui is the main TSControl through which the game is viewed.
|
||||
// The PlayGui also contains the hud controls.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function PlayGui::onWake(%this)
|
||||
{
|
||||
// Turn off any shell sounds...
|
||||
// alxStop( ... );
|
||||
|
||||
$enableDirectInput = "1";
|
||||
activateDirectInput();
|
||||
|
||||
// Message hud dialog
|
||||
Canvas.pushDialog( MainChatHud );
|
||||
chatHud.attach(HudMessageVector);
|
||||
|
||||
// just update the action map here
|
||||
moveMap.push();
|
||||
racingMap.push();
|
||||
|
||||
// hack city - these controls are floating around and need to be clamped
|
||||
schedule(0, 0, "refreshCenterTextCtrl");
|
||||
schedule(0, 0, "refreshBottomTextCtrl");
|
||||
}
|
||||
|
||||
function PlayGui::onSleep(%this)
|
||||
{
|
||||
Canvas.popDialog( MainChatHud );
|
||||
|
||||
// pop the keymaps
|
||||
moveMap.pop();
|
||||
racingMap.pop();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
function PlayGui::updateLapCounter(%this)
|
||||
{
|
||||
LapCounter.setText("Lap" SPC %this.lap SPC "/" SPC %this.maxLaps);
|
||||
}
|
||||
|
||||
function clientCmdSetMaxLaps(%laps)
|
||||
{
|
||||
// Reset the current lap to 1 and set the max laps.
|
||||
PlayGui.lap = 1;
|
||||
PlayGui.maxLaps = %laps;
|
||||
PlayGui.updateLapCounter();
|
||||
}
|
||||
|
||||
function clientCmdIncreaseLapCounter()
|
||||
{
|
||||
// Increase the lap.
|
||||
PlayGui.lap++;
|
||||
PlayGui.updateLapCounter();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function refreshBottomTextCtrl()
|
||||
{
|
||||
BottomPrintText.position = "0 0";
|
||||
}
|
||||
|
||||
function refreshCenterTextCtrl()
|
||||
{
|
||||
CenterPrintText.position = "0 0";
|
||||
}
|
||||
|
||||
|
32
example/starter.racing/client/scripts/playerList.cs
Executable file
@ -0,0 +1,32 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Hook into the client update messages to maintain our player list
|
||||
// and scoreboard.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
addMessageCallback('MsgClientJoin', handleClientJoin);
|
||||
addMessageCallback('MsgClientDrop', handleClientDrop);
|
||||
addMessageCallback('MsgClientScoreChanged', handleClientScoreChanged);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function handleClientJoin(%msgType, %msgString, %clientName, %clientId,
|
||||
%guid, %score, %isAI, %isAdmin, %isSuperAdmin )
|
||||
{
|
||||
PlayerListGui.update(%clientId,detag(%clientName),%isSuperAdmin,
|
||||
%isAdmin,%isAI,%score);
|
||||
}
|
||||
|
||||
function handleClientDrop(%msgType, %msgString, %clientName, %clientId)
|
||||
{
|
||||
PlayerListGui.remove(%clientId);
|
||||
}
|
||||
|
||||
function handleClientScoreChanged(%msgType, %msgString, %score, %clientId)
|
||||
{
|
||||
PlayerListGui.updateScore(%clientId,%score);
|
||||
}
|
166
example/starter.racing/client/scripts/serverConnection.cs
Executable file
@ -0,0 +1,166 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Functions dealing with connecting to a server
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Server connection error
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
addMessageCallback( 'MsgConnectionError', handleConnectionErrorMessage );
|
||||
|
||||
function handleConnectionErrorMessage(%msgType, %msgString, %msgError)
|
||||
{
|
||||
// On connect the server transmits a message to display if there
|
||||
// are any problems with the connection. Most connection errors
|
||||
// are game version differences, so hopefully the server message
|
||||
// will tell us where to get the latest version of the game.
|
||||
$ServerConnectionErrorMessage = %msgError;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// GameConnection client callbacks
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function GameConnection::initialControlSet(%this)
|
||||
{
|
||||
echo ("*** Initial Control Object");
|
||||
|
||||
// The first control object has been set by the server
|
||||
// and we are now ready to go.
|
||||
|
||||
// first check if the editor is active
|
||||
if (!Editor::checkActiveLoadDone())
|
||||
{
|
||||
if (Canvas.getContent() != PlayGui.getId())
|
||||
Canvas.setContent(PlayGui);
|
||||
}
|
||||
}
|
||||
|
||||
function GameConnection::setLagIcon(%this, %state)
|
||||
{
|
||||
if (%this.getAddress() $= "local")
|
||||
return;
|
||||
LagIcon.setVisible(%state $= "true");
|
||||
}
|
||||
|
||||
function GameConnection::onConnectionAccepted(%this)
|
||||
{
|
||||
// Called on the new connection object after connect() succeeds.
|
||||
LagIcon.setVisible(false);
|
||||
}
|
||||
|
||||
function GameConnection::onConnectionTimedOut(%this)
|
||||
{
|
||||
// Called when an established connection times out
|
||||
disconnectedCleanup();
|
||||
MessageBoxOK( "TIMED OUT", "The server connection has timed out.");
|
||||
}
|
||||
|
||||
function GameConnection::onConnectionDropped(%this, %msg)
|
||||
{
|
||||
// Established connection was dropped by the server
|
||||
disconnectedCleanup();
|
||||
MessageBoxOK( "DISCONNECT", "The server has dropped the connection: " @ %msg);
|
||||
}
|
||||
|
||||
function GameConnection::onConnectionError(%this, %msg)
|
||||
{
|
||||
// General connection error, usually raised by ghosted objects
|
||||
// initialization problems, such as missing files. We'll display
|
||||
// the server's connection error message.
|
||||
disconnectedCleanup();
|
||||
MessageBoxOK( "DISCONNECT", $ServerConnectionErrorMessage @ " (" @ %msg @ ")" );
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Connection Failed Events
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function GameConnection::onConnectRequestRejected( %this, %msg )
|
||||
{
|
||||
switch$(%msg)
|
||||
{
|
||||
case "CR_INVALID_PROTOCOL_VERSION":
|
||||
%error = "Incompatible protocol version: Your game version is not compatible with this server.";
|
||||
case "CR_INVALID_CONNECT_PACKET":
|
||||
%error = "Internal Error: badly formed network packet";
|
||||
case "CR_YOUAREBANNED":
|
||||
%error = "You are not allowed to play on this server.";
|
||||
case "CR_SERVERFULL":
|
||||
%error = "This server is full.";
|
||||
case "CHR_PASSWORD":
|
||||
// XXX Should put up a password-entry dialog.
|
||||
if ($Client::Password $= "")
|
||||
MessageBoxOK( "REJECTED", "That server requires a password.");
|
||||
else {
|
||||
$Client::Password = "";
|
||||
MessageBoxOK( "REJECTED", "That password is incorrect.");
|
||||
}
|
||||
return;
|
||||
case "CHR_PROTOCOL":
|
||||
%error = "Incompatible protocol version: Your game version is not compatible with this server.";
|
||||
case "CHR_CLASSCRC":
|
||||
%error = "Incompatible game classes: Your game version is not compatible with this server.";
|
||||
case "CHR_INVALID_CHALLENGE_PACKET":
|
||||
%error = "Internal Error: Invalid server response packet";
|
||||
default:
|
||||
%error = "Connection error. Please try another server. Error code: (" @ %msg @ ")";
|
||||
}
|
||||
disconnectedCleanup();
|
||||
MessageBoxOK( "REJECTED", %error);
|
||||
}
|
||||
|
||||
function GameConnection::onConnectRequestTimedOut(%this)
|
||||
{
|
||||
disconnectedCleanup();
|
||||
MessageBoxOK( "TIMED OUT", "Your connection to the server timed out." );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Disconnect
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function disconnect()
|
||||
{
|
||||
// Delete the connection if it's still there.
|
||||
if (isObject(ServerConnection))
|
||||
ServerConnection.delete();
|
||||
disconnectedCleanup();
|
||||
|
||||
// Call destroyServer in case we're hosting
|
||||
destroyServer();
|
||||
}
|
||||
|
||||
function disconnectedCleanup()
|
||||
{
|
||||
// Clear misc script stuff
|
||||
HudMessageVector.clear();
|
||||
|
||||
// Terminate all playing sounds
|
||||
alxStopAll();
|
||||
if (isObject(MusicPlayer))
|
||||
MusicPlayer.stop();
|
||||
|
||||
//
|
||||
LagIcon.setVisible(false);
|
||||
PlayerListGui.clear();
|
||||
|
||||
// Clear all print messages
|
||||
clientCmdclearBottomPrint();
|
||||
clientCmdClearCenterPrint();
|
||||
|
||||
// Back to the launch screen
|
||||
Canvas.setContent(MainMenuGui);
|
||||
|
||||
// Dump anything we're not using
|
||||
clearTextureHolds();
|
||||
purgeResources();
|
||||
}
|
||||
|
8
example/starter.racing/client/ui/0. About.hfl
Executable file
@ -0,0 +1,8 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial:16>Welcome to the Racing starter Kit.
|
||||
|
||||
<font:Arial Bold:16>About the Starter Kit:<font:Arial:16>The starter kit is a simple example game for you to use in building your own game. This kit is not a complete game in itself, but does illustrate basic play mechanics as well as provide example art. This is a starting point for your future hit title!
|
||||
|
||||
<font:Arial Bold:16>About GarageGames.com:<font:Arial:16> <a:www.garagegames.com>GarageGames</a> is a unique Internet publishing label for independent games and gamemakers. We are a band of professional gaming industry veterans committed to publishing truly original and exciting titles on our own terms. Our mission? To provide the independent developer with tools, knowledge, co-conspirators - whatever is needed to unleash the creative spirit and get great innovative independent games to market.
|
||||
|
||||
<font:Arial Bold:16>About the Torque Game Engine:<font:Arial:16> The <a:www.garagegames.com/pg/product/view.php?id=1>Torque Game Engine</a> (TGE) is the game engine that powers Tribes 2 developed by Dynamix. TGE is a full featured AAA title engine with the latest in scripting, geometry, particle effects, animation and texturing, as well as award winning multi-player networking code. Check out the <a:www.garagegames.com/pg/product/view.php?id=1#features>feature list</a> for more details. For $100 per programmer, you get the source to the engine of a major product from a major game publisher! Not possible? Check the <a:www.garagegames.com/index.php?sec=mg&mod=resource&page=category&qid=122>FAQ</a> for the details.
|
||||
|
68
example/starter.racing/client/ui/1. Credits.hfl
Executable file
@ -0,0 +1,68 @@
|
||||
<just:center><lmargin%:5><rmargin%:95><font:Arial Bold:20>Torque Game Engine Demo Credits...
|
||||
<bitmap:demo/client/ui/seperator>
|
||||
<font:Arial Bold:20>GarageGames.com Staff<font:Arial:16>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=3>Jeff "MotoMan" Tunnell</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=1>Tim "Slacker" Gift</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=2>Rick "Entropy" Overman</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=55>Mark "Got Milk?" Frohnmayer</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=32699>Timothy Aste</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=4517>Robert Blanchet Jr.</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=70688>Thomas Buscaglia</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=26331>Chris Calef</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=5249>Justin DuJardin</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=6452>Clark Fagot</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=985>Matt Fairfax</a>
|
||||
<a:www.www.garagegames.com/my/home/view.profile.php?qid=5318>Nate Feyma</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=10309>Jacob Fike</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=17830>Eric Fritz</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=8863>Ben Garney</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=75501>Kenneth Holst</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=54612>Davey Jackson</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=33542>Matthew Langley</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=36339>Adam Larson</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=1449>Joe Maruschak</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=22782>Mark McCoy</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=46929>Karen Peal</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=6645>John Quigley</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=5030>Brian "Twitch" Ramage</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=10513>Paul Scott</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=69526>Sean Sullivan</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=5263>Alex Swanson</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=71087>James Wiley</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=20592>Josh Williams</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=370>Pat "Killer Bunny" Wilson</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=37827>Zachary Zadell</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=34977>Stephen Zepp</a>
|
||||
|
||||
<bitmap:demo/client/ui/seperator>
|
||||
<font:Arial Bold:20>Special Thanks<font:Arial:16>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=56310>Jon Jorajuria</a>
|
||||
...for revamping the audio of the 1.5 demo!
|
||||
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=44513>Todd Pickens</a>
|
||||
...for donating
|
||||
<a:www.garagegames.com/products/104>FPS Environment Pack Art!</a>
|
||||
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=21036>John Kabus</a>
|
||||
...for his work with the Torque Lighting Kit!
|
||||
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=37490>Joshua Dallman</a>
|
||||
...for
|
||||
<a:www.redthumbgames.com>Red Thumb Game's</a>
|
||||
contribution of Skybox starter material!
|
||||
|
||||
<a:www.garagegames.com/company/associates/>GarageGames Associates</a>
|
||||
|
||||
Some open-source textures used courtesy of...
|
||||
<a:wadfather.planethalflife.gamespy.com/new/>WAD Father - Graphics for Game Developers</a>
|
||||
|
||||
<bitmap:demo/client/ui/seperator>
|
||||
<font:Arial Bold:20>Torque Engine Original Programmers<font:Arial:16>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=438>Dave "Symlink" Moore</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=572>John "Uberbob" Folliard</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=4872>Greg "Jett" Lancaster</a>
|
||||
<a:www.garagegames.com/my/home/view.profile.php?qid=6019>Tim "Kidney Thief" Anderson</a>
|
||||
John "Sne/\ker" Alden
|
||||
Lincoln "Missing" Hutton
|
||||
Brad "BigDevDawg" Heinz
|
||||
Shawn Eastley
|
24
example/starter.racing/client/ui/1.1 Game Controls.hfl
Executable file
@ -0,0 +1,24 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Default Game Control Setup...<font:Arial:16>
|
||||
<tab:105,200>
|
||||
<font:Arial Bold:16>Movement<font:Arial:16>
|
||||
Up Arrow Accelerate
|
||||
Down Arrow Brake/Reverse
|
||||
Left Arrow Turn Left
|
||||
Right Arrow Turn Right
|
||||
Mouse Turn Left/Right
|
||||
Space HandBrake
|
||||
|
||||
<font:Arial Bold:16>View Control<font:Arial:16>
|
||||
E Zoom
|
||||
R Set zoom FOV
|
||||
TAB First/Third person camera
|
||||
Alt-C Toggle between camera/player
|
||||
|
||||
<font:Arial Bold:16>Chat<font:Arial:16>
|
||||
U Send public chat message
|
||||
|
||||
<font:Arial Bold:16>Misc Functions<font:Arial:16>
|
||||
Ctrl-O Open in-game options dialog
|
||||
Ctrl-R Reset car
|
||||
F7 Drop the player at the camera
|
||||
F8 Drop the camera at the player
|
BIN
example/starter.racing/client/ui/1.png
Executable file
After Width: | Height: | Size: 7.1 KiB |
BIN
example/starter.racing/client/ui/2.png
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
example/starter.racing/client/ui/3.png
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
example/starter.racing/client/ui/GarageGames.jpg
Executable file
After Width: | Height: | Size: 378 KiB |
49
example/starter.racing/client/ui/StartupGui.gui
Executable file
@ -0,0 +1,49 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiFadeinBitmapCtrl(StartupGui) {
|
||||
profile = "GuiInputCtrlProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
bitmap = "./GarageGames";
|
||||
wrap = "0";
|
||||
fadeinTime = "125";
|
||||
waitTime = "3000";
|
||||
fadeoutTime = "125";
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
function loadStartup()
|
||||
{
|
||||
StartupGui.done = false;
|
||||
Canvas.setContent( StartupGui );
|
||||
schedule(100, 0, checkStartupDone );
|
||||
// If you want a sound or music to play add a new AudioProfile to client\scripts\audioProfiles.cs
|
||||
// that is named AudioStartup and uncomment the line below. You can see an example of this in the
|
||||
// demo scripts.
|
||||
//alxPlay(AudioStartup);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
function StartupGui::click()
|
||||
{
|
||||
StartupGui.done = true;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
function checkStartupDone()
|
||||
{
|
||||
if (StartupGui.done)
|
||||
{
|
||||
echo ("*** Load Main Menu");
|
||||
loadMainMenu();
|
||||
}
|
||||
else
|
||||
schedule(100, 0, checkStartupDone );
|
||||
}
|
||||
|
96
example/starter.racing/client/ui/aboutDlg.gui
Executable file
@ -0,0 +1,96 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(aboutDlg) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "132 88";
|
||||
extent = "376 303";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "About...";
|
||||
maxLength = "255";
|
||||
resizeWidth = "0";
|
||||
resizeHeight = "0";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
closeCommand = "Canvas.popDialog(aboutDlg);";
|
||||
|
||||
new GuiMLTextCtrl(aboutText) {
|
||||
profile = "GuiMLTextProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "relative";
|
||||
position = "19 36";
|
||||
extent = "336 241";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
text = "This is a test";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "303 268";
|
||||
extent = "60 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.popDialog(aboutDlg);";
|
||||
helpTag = "0";
|
||||
text = "OK";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "12 268";
|
||||
extent = "76 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "getHelp(\"4. License\");";
|
||||
helpTag = "0";
|
||||
text = "License...";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
|
||||
function aboutDlg::onWake(%this)
|
||||
{
|
||||
%text="<just:center><font:Arial Bold:20>Racing Starter Kit\n"@
|
||||
"<font:Arial:12>"@ getCompileTimeString() @", "@ getBuildString() @"Build\n\n"@
|
||||
"<font:Arial:16>Copyright (c) 2001 <a:www.garagegames.com>GarageGames.Com</a>\n"@
|
||||
"<bitmap:rw/client/ui/gglogo150.png>";
|
||||
aboutText.setText(%text);
|
||||
}
|
||||
|
||||
function aboutText::onURL(%this, %url)
|
||||
{
|
||||
echo(%this);
|
||||
echo(%url);
|
||||
gotoWebPage( %url );
|
||||
}
|
||||
|
BIN
example/starter.racing/client/ui/background.jpg
Executable file
After Width: | Height: | Size: 348 KiB |
160
example/starter.racing/client/ui/chatHud.gui
Executable file
@ -0,0 +1,160 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Chat edit window
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new GuiControl(MessageHud)
|
||||
{
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
noCursor = true;
|
||||
|
||||
new GuiBitmapBorderCtrl(MessageHud_Frame) {
|
||||
profile = "ChatHudBorderProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "120 375";
|
||||
extent = "400 40";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "8 8";
|
||||
extent = "384 24";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
bitmap = "./hudfill.png";
|
||||
wrap = "0";
|
||||
};
|
||||
|
||||
new GuiTextCtrl(MessageHud_Text)
|
||||
{
|
||||
profile = "ChatHudTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "14 12";
|
||||
extent = "10 22";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
};
|
||||
|
||||
new GuiTextEditCtrl(MessageHud_Edit)
|
||||
{
|
||||
profile = "ChatHudEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 13";
|
||||
extent = "10 22";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
altCommand = "$ThisControl.eval();";
|
||||
escapeCommand = "MessageHud_Edit.onEscape();";
|
||||
historySize = "5";
|
||||
maxLength = "120";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(MainChatHud) {
|
||||
profile = "GuiModelessDialogProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
noCursor = "1";
|
||||
|
||||
new GuiControl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "relative";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "400 300";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiBitmapBorderCtrl(OuterChatHud) {
|
||||
profile = "ChatHudBorderProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "272 88";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "8 8";
|
||||
extent = "256 72";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
bitmap = "./hudfill.png";
|
||||
wrap = "0";
|
||||
};
|
||||
|
||||
new GuiButtonCtrl(chatPageDown) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "top";
|
||||
position = "220 58";
|
||||
extent = "36 14";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
helpTag = "0";
|
||||
text = "Dwn";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
new GuiScrollCtrl(ChatScrollHud) {
|
||||
profile = "ChatHudScrollProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "8 8";
|
||||
extent = "256 72";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "alwaysOff";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
|
||||
new GuiMessageVectorCtrl(ChatHud) {
|
||||
profile = "ChatHudMessageProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "1 1";
|
||||
extent = "252 16";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "0";
|
||||
lineContinuedIndex = "10";
|
||||
allowedMatches[0] = "http";
|
||||
allowedMatches[1] = "tgeserver";
|
||||
matchColor = "0 0 255 255";
|
||||
maxColorIndex = "5";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
BIN
example/starter.racing/client/ui/chatHudBorderArray.png
Executable file
After Width: | Height: | Size: 8.5 KiB |
BIN
example/starter.racing/client/ui/crossHair.png
Executable file
After Width: | Height: | Size: 329 B |
109
example/starter.racing/client/ui/customProfiles.cs
Executable file
@ -0,0 +1,109 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (c) 2002 GarageGames.Com
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new GuiControlProfile (GuiDefaultProfile)
|
||||
{
|
||||
tab = false;
|
||||
canKeyFocus = false;
|
||||
hasBitmapArray = false;
|
||||
mouseOverSelected = false;
|
||||
|
||||
// fill color
|
||||
opaque = false;
|
||||
fillColor = "201 182 153";
|
||||
fillColorHL = "221 202 173";
|
||||
fillColorNA = "221 202 173";
|
||||
|
||||
// border color
|
||||
border = false;
|
||||
borderColor = "0 0 0";
|
||||
borderColorHL = "179 134 94";
|
||||
borderColorNA = "126 79 37";
|
||||
|
||||
// bevel color
|
||||
bevelColorHL = "255 255 255";
|
||||
bevelColorLL = "0 0 0";
|
||||
|
||||
// font
|
||||
fontType = "Arial";
|
||||
fontSize = 14;
|
||||
fontCharset = CHINESEBIG5;
|
||||
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fontColorNA = "0 0 0";
|
||||
fontColorSEL= "200 200 200";
|
||||
|
||||
// bitmap information
|
||||
bitmap = "./demoWindow";
|
||||
bitmapBase = "";
|
||||
textOffset = "0 0";
|
||||
|
||||
// used by guiTextControl
|
||||
modal = true;
|
||||
justify = "left";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = false;
|
||||
returnTab = false;
|
||||
numbersOnly = false;
|
||||
cursorColor = "0 0 0 255";
|
||||
|
||||
// sounds
|
||||
soundButtonDown = "";
|
||||
soundButtonOver = "";
|
||||
};
|
||||
|
||||
new GuiControlProfile (GuiWindowProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = 2;
|
||||
fillColor = "201 182 153";
|
||||
fillColorHL = "221 202 173";
|
||||
fillColorNA = "221 202 173";
|
||||
fontColor = "255 255 255";
|
||||
fontColorHL = "255 255 255";
|
||||
text = "GuiWindowCtrl test";
|
||||
bitmap = "./demoWindow";
|
||||
textOffset = "6 6";
|
||||
hasBitmapArray = true;
|
||||
justify = "center";
|
||||
};
|
||||
|
||||
new GuiControlProfile (GuiScrollProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
border = 3;
|
||||
borderThickness = 2;
|
||||
borderColor = "0 0 0";
|
||||
bitmap = "./demoScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
new GuiControlProfile (GuiCheckBoxProfile)
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "232 232 232";
|
||||
border = false;
|
||||
borderColor = "0 0 0";
|
||||
fontSize = 14;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
justify = "left";
|
||||
bitmap = "./demoCheck";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
new GuiControlProfile (GuiRadioProfile)
|
||||
{
|
||||
fontSize = 14;
|
||||
fillColor = "232 232 232";
|
||||
fontColorHL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
bitmap = "./demoRadio";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
124
example/starter.racing/client/ui/defaultGameProfiles.cs
Executable file
@ -0,0 +1,124 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Override base controls
|
||||
GuiButtonProfile.soundButtonOver = "AudioButtonOver";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Chat Hud profiles
|
||||
|
||||
|
||||
new GuiControlProfile (ChatHudEditProfile)
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
border = false;
|
||||
borderThickness = 0;
|
||||
borderColor = "40 231 240";
|
||||
fontColor = "40 231 240";
|
||||
fontColorHL = "40 231 240";
|
||||
fontColorNA = "128 128 128";
|
||||
textOffset = "0 2";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = true;
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
new GuiControlProfile (ChatHudTextProfile)
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
border = false;
|
||||
borderThickness = 0;
|
||||
borderColor = "40 231 240";
|
||||
fontColor = "40 231 240";
|
||||
fontColorHL = "40 231 240";
|
||||
fontColorNA = "128 128 128";
|
||||
textOffset = "0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
new GuiControlProfile ("ChatHudMessageProfile")
|
||||
{
|
||||
fontType = "Arial";
|
||||
fontSize = 16;
|
||||
fontColor = "44 172 181"; // default color (death msgs, scoring, inventory)
|
||||
fontColors[1] = "4 235 105"; // client join/drop, tournament mode
|
||||
fontColors[2] = "219 200 128"; // gameplay, admin/voting, pack/deployable
|
||||
fontColors[3] = "77 253 95"; // team chat, spam protection message, client tasks
|
||||
fontColors[4] = "40 231 240"; // global chat
|
||||
fontColors[5] = "200 200 50 200"; // used in single player game
|
||||
// WARNING! Colors 6-9 are reserved for name coloring
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
new GuiControlProfile ("ChatHudScrollProfile")
|
||||
{
|
||||
opaque = false;
|
||||
border = false;
|
||||
borderColor = "0 255 0";
|
||||
bitmap = "common/ui/darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Common Hud profiles
|
||||
|
||||
new GuiControlProfile ("HudScrollProfile")
|
||||
{
|
||||
opaque = false;
|
||||
border = true;
|
||||
borderColor = "0 255 0";
|
||||
bitmap = "common/ui/darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
new GuiControlProfile ("HudTextProfile")
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "128 128 128";
|
||||
fontColor = "0 255 0";
|
||||
border = true;
|
||||
borderColor = "0 255 0";
|
||||
};
|
||||
|
||||
new GuiControlProfile ("ChatHudBorderProfile")
|
||||
{
|
||||
bitmap = "./chatHudBorderArray";
|
||||
hasBitmapArray = true;
|
||||
opaque = false;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Center and bottom print
|
||||
|
||||
new GuiControlProfile ("CenterPrintProfile")
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "128 128 128";
|
||||
fontColor = "0 255 0";
|
||||
border = true;
|
||||
borderColor = "0 255 0";
|
||||
};
|
||||
|
||||
new GuiControlProfile ("CenterPrintTextProfile")
|
||||
{
|
||||
opaque = false;
|
||||
fontType = "Arial";
|
||||
fontSize = 12;
|
||||
fontColor = "0 255 0";
|
||||
};
|
||||
|
||||
|
BIN
example/starter.racing/client/ui/demoCheck.png
Executable file
After Width: | Height: | Size: 304 B |
BIN
example/starter.racing/client/ui/demoMenu.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
example/starter.racing/client/ui/demoRadio.png
Executable file
After Width: | Height: | Size: 528 B |
BIN
example/starter.racing/client/ui/demoScroll.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
example/starter.racing/client/ui/demoWindow.png
Executable file
After Width: | Height: | Size: 2.5 KiB |
3
example/starter.racing/client/ui/disclaimer.dtx
Executable file
@ -0,0 +1,3 @@
|
||||
<lmargin%:6><rmargin%:94><font:Arial:16>Thank you for checking out the GarageGames Community Project - Realm Wars.
|
||||
|
||||
Realm Wars is a work in progress. If you are a game player looking for an epic multiplayer fantasy action game, stay tuned at <a:www.garagegames.com>GarageGames</a> for information about the progress of Realm Wars. If you are a game developer (or aspiring to be one) and want to contribute to the project, <a:www.garagegames.com/mg/projects/realmwars/>click here</a> to get involved.
|
71
example/starter.racing/client/ui/endGameGui.gui
Executable file
@ -0,0 +1,71 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiChunkedBitmapCtrl(EndGameGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
bitmap = "./background";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
|
||||
new GuiControl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "92 86";
|
||||
extent = "455 308";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiMediumTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "101 15";
|
||||
extent = "251 28";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Game Over - Final Scores:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "5 51";
|
||||
extent = "444 251";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
defaultLineHeight = "15";
|
||||
|
||||
new GuiTextListCtrl(EndGameGuiList) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "2 2";
|
||||
extent = "440 16";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0 256";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
BIN
example/starter.racing/client/ui/gglogo150.png
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
example/starter.racing/client/ui/go.png
Executable file
After Width: | Height: | Size: 32 KiB |
BIN
example/starter.racing/client/ui/hudfill.png
Executable file
After Width: | Height: | Size: 510 B |
439
example/starter.racing/client/ui/joinServerGui.gui
Executable file
@ -0,0 +1,439 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiChunkedBitmapCtrl(JoinServerGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
bitmap = "./background.jpg";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiControl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "60 80";
|
||||
extent = "520 320";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "14 59";
|
||||
extent = "24 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Server Name";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl(JS_queryMaster) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "216 289";
|
||||
extent = "90 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.getContent().query();";
|
||||
text = "Query Master";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl(JS_queryLan) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "114 289";
|
||||
extent = "90 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.getContent().queryLan();";
|
||||
text = "Query LAN";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl(JS_refreshServer) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "318 289";
|
||||
extent = "90 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.getContent().refresh();";
|
||||
text = "Refresh Server";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl(JS_joinServer) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "420 289";
|
||||
extent = "90 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.getContent().join();";
|
||||
text = "Join Server!";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
active = "0";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "10 92";
|
||||
extent = "500 186";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
defaultLineHeight = "15";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiTextListCtrl(JS_serverList) {
|
||||
profile = "GuiTextArrayProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "2 2";
|
||||
extent = "478 8";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0 305 370 500";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
noDuplicates = "false";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "98 34";
|
||||
extent = "134 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
variable = "pref::Player::Name";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "12 30";
|
||||
extent = "63 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Player Name:";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "269 59";
|
||||
extent = "36 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Players";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "335 59";
|
||||
extent = "38 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Version";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "412 59";
|
||||
extent = "28 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Game";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "212 59";
|
||||
extent = "20 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Ping";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "72 59";
|
||||
extent = "63 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Server Name";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "12 289";
|
||||
extent = "90 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.getContent().exit();";
|
||||
text = "<< Back";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiControl(JS_queryStatus) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "105 135";
|
||||
extent = "310 50";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiButtonCtrl(JS_cancelQuery) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "9 15";
|
||||
extent = "64 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.getContent().cancel();";
|
||||
text = "Cancel!";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiProgressCtrl(JS_statusBar) {
|
||||
profile = "GuiProgressProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "84 15";
|
||||
extent = "207 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl(JS_statusText) {
|
||||
profile = "GuiProgressTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "85 14";
|
||||
extent = "205 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
new GuiTextCtrl(JS_status) {
|
||||
profile = "GuiBigTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "243 14";
|
||||
extent = "266 40";
|
||||
minExtent = "266 40";
|
||||
visible = "1";
|
||||
maxLength = "255";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::onWake()
|
||||
{
|
||||
// Double check the status. Tried setting this the control
|
||||
// inactive to start with, but that didn't seem to work.
|
||||
JS_joinServer.setActive(JS_serverList.rowCount() > 0);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::query(%this)
|
||||
{
|
||||
queryMasterServer(
|
||||
0, // Query flags
|
||||
$Client::GameTypeQuery, // gameTypes
|
||||
$Client::MissionTypeQuery, // missionType
|
||||
0, // minPlayers
|
||||
100, // maxPlayers
|
||||
0, // maxBots
|
||||
2, // regionMask
|
||||
0, // maxPing
|
||||
100, // minCPU
|
||||
0 // filterFlags
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::queryLan(%this)
|
||||
{
|
||||
queryLANServers(
|
||||
28000, // lanPort for local queries
|
||||
0, // Query flags
|
||||
$Client::GameTypeQuery, // gameTypes
|
||||
$Client::MissionTypeQuery, // missionType
|
||||
0, // minPlayers
|
||||
100, // maxPlayers
|
||||
0, // maxBots
|
||||
2, // regionMask
|
||||
0, // maxPing
|
||||
100, // minCPU
|
||||
0 // filterFlags
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::cancel(%this)
|
||||
{
|
||||
cancelServerQuery();
|
||||
JS_queryStatus.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::join(%this)
|
||||
{
|
||||
cancelServerQuery();
|
||||
%id = JS_serverList.getSelectedId();
|
||||
|
||||
// The server info index is stored in the row along with the
|
||||
// rest of displayed info.
|
||||
%index = getField(JS_serverList.getRowTextById(%id),3);
|
||||
if (setServerInfo(%index)) {
|
||||
%conn = new GameConnection(ServerConnection);
|
||||
%conn.setConnectArgs($pref::Player::Name);
|
||||
%conn.setJoinPassword($Client::Password);
|
||||
%conn.connect($ServerInfo::Address);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::refresh(%this)
|
||||
{
|
||||
cancelServerQuery();
|
||||
%id = JS_serverList.getSelectedId();
|
||||
|
||||
// The server info index is stored in the row along with the
|
||||
// rest of displayed info.
|
||||
%index = getField(JS_serverList.getRowTextById(%id),3);
|
||||
if (setServerInfo(%index)) {
|
||||
querySingleServer( $ServerInfo::Address, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::refreshSelectedServer( %this )
|
||||
{
|
||||
querySingleServer( $JoinGameAddress, 0 );
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::exit(%this)
|
||||
{
|
||||
cancelServerQuery();
|
||||
Canvas.setContent(mainMenuGui);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
function JoinServerGui::update(%this)
|
||||
{
|
||||
// Copy the servers into the server list.
|
||||
JS_queryStatus.setVisible(false);
|
||||
JS_serverList.clear();
|
||||
%sc = getServerCount();
|
||||
for (%i = 0; %i < %sc; %i++) {
|
||||
setServerInfo(%i);
|
||||
JS_serverList.addRow(%i,
|
||||
$ServerInfo::Name TAB
|
||||
$ServerInfo::Ping TAB
|
||||
$ServerInfo::PlayerCount @ "/" @ $ServerInfo::MaxPlayers TAB
|
||||
%i); // ServerInfo index stored also
|
||||
}
|
||||
JS_serverList.sort(0);
|
||||
JS_serverList.setSelectedRow(0);
|
||||
JS_serverList.scrollVisible(0);
|
||||
|
||||
JS_joinServer.setActive(JS_serverList.rowCount() > 0);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
function onServerQueryStatus(%status, %msg, %value)
|
||||
{
|
||||
echo("ServerQuery: " SPC %status SPC %msg SPC %value);
|
||||
// Update query status
|
||||
// States: start, update, ping, query, done
|
||||
// value = % (0-1) done for ping and query states
|
||||
if (!JS_queryStatus.isVisible())
|
||||
JS_queryStatus.setVisible(true);
|
||||
|
||||
switch$ (%status) {
|
||||
case "start":
|
||||
JS_joinServer.setActive(false);
|
||||
JS_queryMaster.setActive(false);
|
||||
JS_statusText.setText(%msg);
|
||||
JS_statusBar.setValue(0);
|
||||
JS_serverList.clear();
|
||||
|
||||
case "ping":
|
||||
JS_statusText.setText("Ping Servers");
|
||||
JS_statusBar.setValue(%value);
|
||||
|
||||
case "query":
|
||||
JS_statusText.setText("Query Servers");
|
||||
JS_statusBar.setValue(%value);
|
||||
|
||||
case "done":
|
||||
JS_queryMaster.setActive(true);
|
||||
JS_queryStatus.setVisible(false);
|
||||
JS_status.setText(%msg);
|
||||
JoinServerGui.update();
|
||||
}
|
||||
}
|
||||
|
BIN
example/starter.racing/client/ui/lagIcon.png
Executable file
After Width: | Height: | Size: 2.9 KiB |
99
example/starter.racing/client/ui/loadingGui.gui
Executable file
@ -0,0 +1,99 @@
|
||||
new GuiControlProfile ("LoadingGuiContentProfile")
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "200 200 200";
|
||||
border = true;
|
||||
borderColor = "0 0 0";
|
||||
};
|
||||
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiChunkedBitmapCtrl(LoadingGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
bitmap = "./background";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
helpTag = "0";
|
||||
qLineCount = "0";
|
||||
|
||||
new GuiControl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "92 86";
|
||||
extent = "455 308";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiTextCtrl(LOAD_MapName) {
|
||||
profile = "GuiMediumTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "7 6";
|
||||
extent = "8 28";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Map Name";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiMLTextCtrl(LOAD_MapDescription) {
|
||||
profile = "GuiMLTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "7 62";
|
||||
extent = "440 14";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiProgressCtrl(LoadingProgress) {
|
||||
profile = "GuiProgressProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "128 262";
|
||||
extent = "262 25";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiTextCtrl(LoadingProgressTxt) {
|
||||
profile = "GuiProgressTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "-4 3";
|
||||
extent = "262 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "LOADING MISSION";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "58 262";
|
||||
extent = "65 25";
|
||||
minExtent = "20 20";
|
||||
visible = "1";
|
||||
command = "disconnect();";
|
||||
accelerator = "escape";
|
||||
text = "Cancel!";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
89
example/starter.racing/client/ui/mainMenuGui.gui
Executable file
@ -0,0 +1,89 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiChunkedBitmapCtrl(MainMenuGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
bitmap = "./background";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "36 413";
|
||||
extent = "110 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "quit();";
|
||||
text = "Quit!";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "36 237";
|
||||
extent = "110 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.setContent(startMissionGui);";
|
||||
text = "Start Mission...";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "36 264";
|
||||
extent = "110 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.setContent(JoinServerGui);";
|
||||
text = "Join Server...";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "36 291";
|
||||
extent = "110 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.pushDialog(optionsDlg);";
|
||||
text = "Options...";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "36 318";
|
||||
extent = "110 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "getHelp(\"1. About\");";
|
||||
text = "About...";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
|
||||
|
433
example/starter.racing/client/ui/optionsDlg.gui
Executable file
@ -0,0 +1,433 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(optionsDlg) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "131 88";
|
||||
extent = "377 303";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Options";
|
||||
maxLength = "255";
|
||||
resizeWidth = "0";
|
||||
resizeHeight = "0";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
closeCommand = "Canvas.popDialog(optionsDlg);";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "305 270";
|
||||
extent = "60 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.popDialog(optionsDlg);";
|
||||
helpTag = "0";
|
||||
text = "OK";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
new GuiButtonCtrl(OptGraphicsButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "9 28";
|
||||
extent = "117 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "optionsDlg.setPane(Graphics);";
|
||||
helpTag = "0";
|
||||
text = "Graphics";
|
||||
groupNum = "-1";
|
||||
buttonType = "RadioButton";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "129 28";
|
||||
extent = "117 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "optionsDlg.setPane(Audio);";
|
||||
helpTag = "0";
|
||||
text = "Audio";
|
||||
groupNum = "-1";
|
||||
buttonType = "RadioButton";
|
||||
};
|
||||
new GuiControl(OptControlsPane) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "9 55";
|
||||
extent = "357 208";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 26";
|
||||
extent = "357 182";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
defaultLineHeight = "15";
|
||||
|
||||
new GuiTextListCtrl(OptRemapList) {
|
||||
profile = "GuiTextListProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "2 2";
|
||||
extent = "337 8";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
altCommand = "OptRemapList.doRemap();";
|
||||
helpTag = "0";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0 160";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
};
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "5 2";
|
||||
extent = "64 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Control Name";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "166 2";
|
||||
extent = "72 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Control Binding";
|
||||
maxLength = "255";
|
||||
};
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "249 28";
|
||||
extent = "117 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "optionsDlg.setPane(Controls);";
|
||||
helpTag = "0";
|
||||
text = "Controls";
|
||||
groupNum = "-1";
|
||||
buttonType = "RadioButton";
|
||||
};
|
||||
new GuiControl(OptAudioPane) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "9 55";
|
||||
extent = "357 208";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiSliderCtrl(OptAudioVolumeSim) {
|
||||
profile = "GuiSliderProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "107 172";
|
||||
extent = "240 34";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
variable = "value";
|
||||
altCommand = "OptAudioUpdateChannelVolume($SimAudioType, OptAudioVolumeSim.value);";
|
||||
helpTag = "0";
|
||||
range = "0.000000 1.000000";
|
||||
ticks = "8";
|
||||
value = "0.8";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "11 94";
|
||||
extent = "72 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Master Volume";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "22 132";
|
||||
extent = "62 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Shell Volume";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "28 169";
|
||||
extent = "56 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Sim Volume";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiSliderCtrl(OptAudioVolumeMaster) {
|
||||
profile = "GuiSliderProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "106 98";
|
||||
extent = "240 34";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
variable = "value";
|
||||
altCommand = "OptAudioUpdateMasterVolume(OptAudioVolumeMaster.value);";
|
||||
helpTag = "0";
|
||||
range = "0.000000 1.000000";
|
||||
ticks = "8";
|
||||
value = "0.852174";
|
||||
};
|
||||
new GuiSliderCtrl(OptAudioVolumeShell) {
|
||||
profile = "GuiSliderProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "106 135";
|
||||
extent = "240 34";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
variable = "value";
|
||||
altCommand = "OptAudioUpdateChannelVolume($GuiAudioType, OptAudioVolumeShell.value);";
|
||||
helpTag = "0";
|
||||
range = "0.000000 1.000000";
|
||||
ticks = "8";
|
||||
value = "0.8";
|
||||
};
|
||||
new GuiMLTextCtrl(OptAudioInfo) {
|
||||
profile = "GuiMLTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "149 10";
|
||||
extent = "190 14";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(OptAudioDriverList) {
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "10 32";
|
||||
extent = "120 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
maxPopupHeight = "200";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "11 9";
|
||||
extent = "63 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Audio Driver:";
|
||||
maxLength = "255";
|
||||
};
|
||||
};
|
||||
new GuiControl(OptGraphicsPane) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "9 55";
|
||||
extent = "357 208";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "21 10";
|
||||
extent = "70 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Display Driver:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "21 34";
|
||||
extent = "53 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Resolution:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiCheckBoxCtrl(OptGraphicsFullscreenToggle) {
|
||||
profile = "GuiCheckBoxProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "21 120";
|
||||
extent = "137 25";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
variable = "$pref::Video::fullScreen";
|
||||
helpTag = "0";
|
||||
text = "Fullscreen Video";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "149 171";
|
||||
extent = "78 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "optionsDlg.applyGraphics();";
|
||||
helpTag = "0";
|
||||
text = "Apply";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(OptGraphicsDriverMenu) {
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "113 10";
|
||||
extent = "130 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
maxPopupHeight = "200";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(OptGraphicsResolutionMenu) {
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "113 36";
|
||||
extent = "130 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
maxPopupHeight = "200";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "21 60";
|
||||
extent = "46 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Bit Depth:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(OptGraphicsBPPMenu) {
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "113 62";
|
||||
extent = "130 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
maxPopupHeight = "200";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "21 86";
|
||||
extent = "59 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Screenshot:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(OptScreenshotMenu) {
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "113 88";
|
||||
extent = "130 23";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
maxPopupHeight = "200";
|
||||
};
|
||||
};
|
||||
new GuiControl(OptNetworkPane) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "9 55";
|
||||
extent = "357 208";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
136
example/starter.racing/client/ui/playGui.gui
Executable file
@ -0,0 +1,136 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GameTSCtrl(PlayGui) {
|
||||
canSaveDynamicFields = "1";
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
cameraZRot = "0";
|
||||
forceFOV = "0";
|
||||
noCursor = "1";
|
||||
|
||||
new GuiBitmapCtrl(CenterPrintDlg) {
|
||||
profile = "CenterPrintProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "45 230";
|
||||
extent = "550 20";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
bitmap = "./hudfill.png";
|
||||
wrap = "0";
|
||||
|
||||
new GuiMLTextCtrl(CenterPrintText) {
|
||||
profile = "CenterPrintTextProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "0 0";
|
||||
extent = "546 12";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
};
|
||||
new GuiBitmapCtrl(BottomPrintDlg) {
|
||||
profile = "CenterPrintProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "top";
|
||||
position = "45 375";
|
||||
extent = "550 20";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
bitmap = "./hudfill.png";
|
||||
wrap = "0";
|
||||
|
||||
new GuiMLTextCtrl(BottomPrintText) {
|
||||
profile = "CenterPrintTextProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "0 0";
|
||||
extent = "546 12";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
};
|
||||
new GuiBitmapCtrl(LagIcon) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "572 3";
|
||||
extent = "32 32";
|
||||
minExtent = "8 8";
|
||||
visible = "0";
|
||||
bitmap = "./lagIcon.png";
|
||||
wrap = "0";
|
||||
};
|
||||
new GuiShapeNameHud() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "2 -1";
|
||||
extent = "653 485";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
fillColor = "0.000000 0.000000 0.000000 0.250000";
|
||||
frameColor = "0.000000 1.000000 0.000000 1.000000";
|
||||
textColor = "0.000000 1.000000 0.000000 1.000000";
|
||||
showFill = "0";
|
||||
showFrame = "0";
|
||||
verticalOffset = "0.2";
|
||||
distanceFade = "0.1";
|
||||
damageFrameColor = "1.000000 0.600000 0.000000 1.000000";
|
||||
damageRect = "30 4";
|
||||
helpTag = "0";
|
||||
damageFillColor = "0.000000 1.000000 0.000000 1.000000";
|
||||
};
|
||||
new GuiSpeedometerHud() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "top";
|
||||
position = "440 280";
|
||||
extent = "200 200";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
bitmap = "./speedometer";
|
||||
wrap = "0";
|
||||
maxSpeed = "100";
|
||||
minAngle = "215";
|
||||
maxAngle = "0";
|
||||
color = "1.000000 0.300000 0.300000 1.000000";
|
||||
center = "130.000000 123.000000";
|
||||
length = "100";
|
||||
width = "2";
|
||||
tail = "0";
|
||||
};
|
||||
new GuiBitmapCtrl(counter) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "130 110";
|
||||
extent = "380 260";
|
||||
minExtent = "8 2";
|
||||
visible = "0";
|
||||
bitmap = "./hud/go.png";
|
||||
wrap = "0";
|
||||
};
|
||||
new GuiTextCtrl(LapCounter) {
|
||||
profile = "GuiBigTextProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "450 5";
|
||||
extent = "170 39";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "Laps: 0";
|
||||
maxLength = "255";
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
148
example/starter.racing/client/ui/playerList.gui
Executable file
@ -0,0 +1,148 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(PlayerListGui) {
|
||||
profile = "GuiModelessDialogProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
noCursor = "1";
|
||||
|
||||
new GuiBitmapBorderCtrl() {
|
||||
profile = "GuiBitmapBorderProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "241 119";
|
||||
extent = "158 242";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
profile = "HudScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "5 5";
|
||||
extent = "147 231";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
bitmap = "./hudfill.png";
|
||||
wrap = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
profile = "HudTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "37 2";
|
||||
extent = "76 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Score Board";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiScrollCtrl() {
|
||||
profile = "HudScrollProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 24";
|
||||
extent = "147 207";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
defaultLineHeight = "15";
|
||||
|
||||
new GuiTextListCtrl(PlayerListGuiList) {
|
||||
profile = "HudTextProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "1 1";
|
||||
extent = "145 16";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0 120";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
function PlayerListGui::update(%this,%clientId,%name,%isSuperAdmin,%isAdmin,%isAI,%score)
|
||||
{
|
||||
// Build the row to display. The name can have ML control tags,
|
||||
// including color and font. Since we're not using and
|
||||
// ML control here, we need to strip them off.
|
||||
%tag = %isSuperAdmin? "[Super]":
|
||||
(%isAdmin? "[Admin]":
|
||||
(%isAI? "[Bot]":
|
||||
""));
|
||||
%text = StripMLControlChars(%name) SPC %tag TAB %score;
|
||||
|
||||
// Update or add the player to the control
|
||||
if (PlayerListGuiList.getRowNumById(%clientId) == -1)
|
||||
PlayerListGuiList.addRow(%clientId, %text);
|
||||
else
|
||||
PlayerListGuiList.setRowById(%clientId, %text);
|
||||
|
||||
// Sorts by score
|
||||
PlayerListGuiList.sortNumerical(1,false);
|
||||
PlayerListGuiList.clearSelection();
|
||||
}
|
||||
|
||||
function PlayerListGui::updateScore(%this,%clientId,%score)
|
||||
{
|
||||
%text = PlayerListGuiList.getRowTextById(%clientId);
|
||||
%text = setField(%text,1,%score);
|
||||
PlayerListGuiList.setRowById(%clientId, %text);
|
||||
PlayerListGuiList.sortNumerical(1,false);
|
||||
PlayerListGuiList.clearSelection();
|
||||
}
|
||||
|
||||
function PlayerListGui::remove(%this,%clientId)
|
||||
{
|
||||
PlayerListGuiList.removeRowById(%clientId);
|
||||
}
|
||||
|
||||
function PlayerListGui::toggle(%this)
|
||||
{
|
||||
if (%this.isAwake())
|
||||
Canvas.popDialog(%this);
|
||||
else
|
||||
Canvas.pushDialog(%this);
|
||||
}
|
||||
|
||||
function PlayerListGui::clear(%this)
|
||||
{
|
||||
// Override to clear the list.
|
||||
PlayerListGuiList.clear();
|
||||
}
|
||||
|
||||
function PlayerListGui::zeroScores(%this)
|
||||
{
|
||||
for (%i = 0; %i < PlayerListGuiList.rowCount(); %i++) {
|
||||
%text = PlayerListGuiList.getRowText(%i);
|
||||
%text = setField(%text,1,"0");
|
||||
PlayerListGuiList.setRowById(PlayerListGuiList.getRowId(%i), %text);
|
||||
}
|
||||
PlayerListGuiList.clearSelection();
|
||||
}
|
46
example/starter.racing/client/ui/remapDlg.gui
Executable file
@ -0,0 +1,46 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(RemapDlg) {
|
||||
profile = "GuiDialogProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiControl(OptRemapDlg) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "213 213";
|
||||
extent = "243 64";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiTextCtrl(OptRemapText) {
|
||||
profile = "GuiCenterTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "2 21";
|
||||
extent = "99 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Re-bind control...";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiInputCtrl(OptRemapInputCtrl) {
|
||||
profile = "GuiInputCtrlProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "64 64";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
BIN
example/starter.racing/client/ui/seperator.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
example/starter.racing/client/ui/speedometer.png
Executable file
After Width: | Height: | Size: 30 KiB |
218
example/starter.racing/client/ui/startMissionGui.gui
Executable file
@ -0,0 +1,218 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiChunkedBitmapCtrl(startMissionGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
bitmap = "./background";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiControl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "92 86";
|
||||
extent = "455 308";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "12 36";
|
||||
extent = "72 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Select Mission:";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiCheckBoxCtrl(ML_isMultiplayer) {
|
||||
profile = "GuiCheckBoxProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "155 272";
|
||||
extent = "147 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
variable = "pref::HostMultiPlayer";
|
||||
text = "Host Multiplayer";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "320 271";
|
||||
extent = "127 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "SM_StartMission();";
|
||||
text = "Launch Mission!";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "10 62";
|
||||
extent = "436 200";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
helpTag = "0";
|
||||
defaultLineHeight = "15";
|
||||
|
||||
new GuiTextListCtrl(SM_missionList) {
|
||||
profile = "GuiTextArrayProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "2 2";
|
||||
extent = "414 16";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
helpTag = "0";
|
||||
noDuplicates = "false";
|
||||
};
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "98 15";
|
||||
extent = "134 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
variable = "pref::Player::Name";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "12 11";
|
||||
extent = "63 18";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Player Name:";
|
||||
maxLength = "255";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "10 272";
|
||||
extent = "127 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.setContent(mainMenuGui);";
|
||||
text = "<< Back";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
function SM_StartMission()
|
||||
{
|
||||
%id = SM_missionList.getSelectedId();
|
||||
%mission = getField(SM_missionList.getRowTextById(%id), 1);
|
||||
|
||||
if ($pref::HostMultiPlayer)
|
||||
%serverType = "MultiPlayer";
|
||||
else
|
||||
%serverType = "SinglePlayer";
|
||||
|
||||
createServer(%serverType, %mission);
|
||||
%conn = new GameConnection(ServerConnection);
|
||||
RootGroup.add(ServerConnection);
|
||||
%conn.setConnectArgs($pref::Player::Name);
|
||||
%conn.setJoinPassword($Client::Password);
|
||||
%conn.connectLocal();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
function startMissionGui::onWake()
|
||||
{
|
||||
SM_missionList.clear();
|
||||
%i = 0;
|
||||
for(%file = findFirstFile($Server::MissionFileSpec); %file !$= ""; %file = findNextFile($Server::MissionFileSpec))
|
||||
if (strStr(%file, "/CVS/") == -1)
|
||||
SM_missionList.addRow(%i++, getMissionDisplayName(%file) @ "\t" @ %file );
|
||||
SM_missionList.sort(0);
|
||||
SM_missionList.setSelectedRow(0);
|
||||
SM_missionList.scrollVisible(0);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
function getMissionDisplayName( %missionFile )
|
||||
{
|
||||
%file = new FileObject();
|
||||
|
||||
%MissionInfoObject = "";
|
||||
|
||||
if ( %file.openForRead( %missionFile ) ) {
|
||||
%inInfoBlock = false;
|
||||
|
||||
while ( !%file.isEOF() ) {
|
||||
%line = %file.readLine();
|
||||
%line = trim( %line );
|
||||
|
||||
if( %line $= "new ScriptObject(MissionInfo) {" )
|
||||
%inInfoBlock = true;
|
||||
else if( %inInfoBlock && %line $= "};" ) {
|
||||
%inInfoBlock = false;
|
||||
%MissionInfoObject = %MissionInfoObject @ %line;
|
||||
break;
|
||||
}
|
||||
|
||||
if( %inInfoBlock )
|
||||
%MissionInfoObject = %MissionInfoObject @ %line @ " ";
|
||||
}
|
||||
|
||||
%file.close();
|
||||
}
|
||||
%MissionInfoObject = "%MissionInfoObject = " @ %MissionInfoObject;
|
||||
eval( %MissionInfoObject );
|
||||
|
||||
%file.delete();
|
||||
|
||||
if( %MissionInfoObject.name !$= "" )
|
||||
return %MissionInfoObject.name;
|
||||
else
|
||||
return fileBase(%missionFile);
|
||||
}
|
||||
|