Initial commit
1
example/DeleteDSOs.bat
Executable file
@ -0,0 +1 @@
|
||||
del /s *.dso
|
4
example/DeletePrefs.bat
Executable file
@ -0,0 +1,4 @@
|
||||
del /s prefs.cs
|
||||
del /s config.cs
|
||||
del /s config.cs.dso
|
||||
del /s prefs.cs.dso
|
BIN
example/GettingStarted.pdf
Executable file
6
example/Launch using show mod.command
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd `dirname "$0"`
|
||||
|
||||
./Torque\ Demo\ OSX.app/Contents/MacOS/Torque\ Demo\ OSX -mod show
|
||||
|
BIN
example/OpenAL32.dll
Executable file
BIN
example/TorqueShowToolPro.exe
Normal file
BIN
example/common/TestMap.jpg
Executable file
After Width: | Height: | Size: 66 KiB |
43
example/common/client/actionMap.cs
Executable file
@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Utility remap functions:
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ActionMap::copyBind( %this, %otherMap, %command )
|
||||
{
|
||||
if ( !isObject( %otherMap ) )
|
||||
{
|
||||
error( "ActionMap::copyBind - \"" @ %otherMap @ "\" is not an object!" );
|
||||
return;
|
||||
}
|
||||
|
||||
%bind = %otherMap.getBinding( %command );
|
||||
if ( %bind !$= "" )
|
||||
{
|
||||
%device = getField( %bind, 0 );
|
||||
%action = getField( %bind, 1 );
|
||||
%flags = %otherMap.isInverted( %device, %action ) ? "SDI" : "SD";
|
||||
%deadZone = %otherMap.getDeadZone( %device, %action );
|
||||
%scale = %otherMap.getScale( %device, %action );
|
||||
%this.bind( %device, %action, %flags, %deadZone, %scale, %command );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ActionMap::blockBind( %this, %otherMap, %command )
|
||||
{
|
||||
if ( !isObject( %otherMap ) )
|
||||
{
|
||||
error( "ActionMap::blockBind - \"" @ %otherMap @ "\" is not an object!" );
|
||||
return;
|
||||
}
|
||||
|
||||
%bind = %otherMap.getBinding( %command );
|
||||
if ( %bind !$= "" )
|
||||
%this.bind( getField( %bind, 0 ), getField( %bind, 1 ), "" );
|
||||
}
|
||||
|
50
example/common/client/audio.cs
Executable file
@ -0,0 +1,50 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Engine
|
||||
//
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function OpenALInit()
|
||||
{
|
||||
OpenALShutdownDriver();
|
||||
|
||||
echo("");
|
||||
echo("OpenAL Driver Init:");
|
||||
|
||||
echo ($pref::Audio::driver);
|
||||
|
||||
if($pref::Audio::driver $= "OpenAL")
|
||||
{
|
||||
if(!OpenALInitDriver())
|
||||
{
|
||||
error(" Failed to initialize driver.");
|
||||
$Audio::initFailed = true;
|
||||
} else {
|
||||
// this should go here
|
||||
echo(" Vendor: " @ alGetString("AL_VENDOR"));
|
||||
echo(" Version: " @ alGetString("AL_VERSION"));
|
||||
echo(" Renderer: " @ alGetString("AL_RENDERER"));
|
||||
echo(" Extensions: " @ alGetString("AL_EXTENSIONS"));
|
||||
|
||||
alxListenerf( AL_GAIN_LINEAR, $pref::Audio::masterVolume );
|
||||
|
||||
for (%channel=1; %channel <= 8; %channel++)
|
||||
alxSetChannelVolume(%channel, $pref::Audio::channelVolume[%channel]);
|
||||
|
||||
echo("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function OpenALShutdown()
|
||||
{
|
||||
OpenALShutdownDriver();
|
||||
//alxStopAll();
|
||||
//AudioGui.delete();
|
||||
//sButtonDown.delete();
|
||||
//sButtonOver.delete();
|
||||
}
|
65
example/common/client/canvas.cs
Executable file
@ -0,0 +1,65 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Function to construct and initialize the default canvas window
|
||||
// used by the games
|
||||
|
||||
function initCanvas(%windowName, %effectCanvas)
|
||||
{
|
||||
videoSetGammaCorrection($pref::OpenGL::gammaCorrection);
|
||||
|
||||
if( %effectCanvas )
|
||||
%canvasCreate = createEffectCanvas( %windowName );
|
||||
else
|
||||
%canvasCreate = createCanvas( %windowName );
|
||||
|
||||
if( !%canvasCreate )
|
||||
{
|
||||
quitWithErrorMessage("Copy of Torque is already running; exiting.");
|
||||
return;
|
||||
}
|
||||
|
||||
setOpenGLTextureCompressionHint( $pref::OpenGL::compressionHint );
|
||||
setOpenGLAnisotropy( $pref::OpenGL::textureAnisotropy );
|
||||
setOpenGLMipReduction( $pref::OpenGL::mipReduction );
|
||||
setOpenGLInteriorMipReduction( $pref::OpenGL::interiorMipReduction );
|
||||
setOpenGLSkyMipReduction( $pref::OpenGL::skyMipReduction );
|
||||
|
||||
// Declare default GUI Profiles.
|
||||
exec("~/ui/defaultProfiles.cs");
|
||||
|
||||
// Common GUI's
|
||||
exec("~/ui/ConsoleDlg.gui");
|
||||
exec("~/ui/LoadFileDlg.gui");
|
||||
exec("~/ui/ColorPickerDlg.gui");
|
||||
exec("~/ui/SaveFileDlg.gui");
|
||||
exec("~/ui/MessageBoxOkDlg.gui");
|
||||
exec("~/ui/MessageBoxYesNoDlg.gui");
|
||||
exec("~/ui/MessageBoxOKCancelDlg.gui");
|
||||
exec("~/ui/MessagePopupDlg.gui");
|
||||
exec("~/ui/HelpDlg.gui");
|
||||
exec("~/ui/RecordingsDlg.gui");
|
||||
exec("~/ui/NetGraphGui.gui");
|
||||
|
||||
// Commonly used helper scripts
|
||||
exec("./metrics.cs");
|
||||
exec("./messageBox.cs");
|
||||
exec("./screenshot.cs");
|
||||
exec("./cursor.cs");
|
||||
exec("./help.cs");
|
||||
exec("./recordings.cs");
|
||||
|
||||
// Init the audio system
|
||||
OpenALInit();
|
||||
}
|
||||
|
||||
function resetCanvas()
|
||||
{
|
||||
if (isObject(Canvas))
|
||||
{
|
||||
Canvas.repaint();
|
||||
}
|
||||
}
|
98
example/common/client/cursor.cs
Executable file
@ -0,0 +1,98 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Cursor Control
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
$cursorControlled = true;
|
||||
|
||||
function cursorOff()
|
||||
{
|
||||
if ( $cursorControlled )
|
||||
lockMouse(true);
|
||||
Canvas.cursorOff();
|
||||
}
|
||||
|
||||
function cursorOn()
|
||||
{
|
||||
if ( $cursorControlled )
|
||||
lockMouse(false);
|
||||
Canvas.cursorOn();
|
||||
Canvas.setCursor(DefaultCursor);
|
||||
}
|
||||
|
||||
// In the CanvasCursor package we add some additional functionality to the
|
||||
// built-in GuiCanvas class, of which the global Canvas object is an instance.
|
||||
// In this case, the behavior we want is for the cursor to automatically display,
|
||||
// except when the only guis visible want no cursor - most notably,
|
||||
// in the case of the example, the play gui.
|
||||
// In order to override or extend an existing class, we use the script package
|
||||
// feature.
|
||||
|
||||
package CanvasCursor
|
||||
{
|
||||
|
||||
// The checkCursor method iterates through all the root controls on the canvas
|
||||
// (basically the content control and any visible dialogs). If all of them
|
||||
// have the .noCursor attribute set, the cursor is turned off, otherwise it is
|
||||
// turned on.
|
||||
|
||||
function GuiCanvas::checkCursor(%this)
|
||||
{
|
||||
%cursorShouldBeOn = false;
|
||||
for(%i = 0; %i < %this.getCount(); %i++)
|
||||
{
|
||||
%control = %this.getObject(%i);
|
||||
if(%control.noCursor == 0)
|
||||
{
|
||||
%cursorShouldBeOn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(%cursorShouldBeOn != %this.isCursorOn())
|
||||
{
|
||||
if(%cursorShouldBeOn)
|
||||
cursorOn();
|
||||
else
|
||||
cursorOff();
|
||||
}
|
||||
}
|
||||
|
||||
// below, all functions which can alter which content controls are visible
|
||||
// are extended to call the checkCursor function. For package'd functions,
|
||||
// the Parent:: call refers to the original implementation of that function,
|
||||
// or a version that was declared in a previously activated package.
|
||||
// In this case the parent calls should point to the built in versions
|
||||
// of GuiCanvas functions.
|
||||
|
||||
function GuiCanvas::setContent(%this, %ctrl)
|
||||
{
|
||||
Parent::setContent(%this, %ctrl);
|
||||
%this.checkCursor();
|
||||
}
|
||||
|
||||
function GuiCanvas::pushDialog(%this, %ctrl, %layer)
|
||||
{
|
||||
Parent::pushDialog(%this, %ctrl, %layer);
|
||||
%this.checkCursor();
|
||||
}
|
||||
|
||||
function GuiCanvas::popDialog(%this, %ctrl)
|
||||
{
|
||||
Parent::popDialog(%this, %ctrl);
|
||||
%this.checkCursor();
|
||||
}
|
||||
|
||||
function GuiCanvas::popLayer(%this, %layer)
|
||||
{
|
||||
Parent::popLayer(%this, %layer);
|
||||
%this.checkCursor();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// activate the package when the script loads.
|
||||
activatePackage(CanvasCursor);
|
74
example/common/client/help.cs
Executable file
@ -0,0 +1,74 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Engine
|
||||
//
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function HelpDlg::onWake(%this)
|
||||
{
|
||||
HelpFileList.entryCount = 0;
|
||||
HelpFileList.clear();
|
||||
for(%file = findFirstFile("*.hfl"); %file !$= ""; %file = findNextFile("*.hfl"))
|
||||
{
|
||||
HelpFileList.fileName[HelpFileList.entryCount] = %file;
|
||||
HelpFileList.addRow(HelpFileList.entryCount, fileBase(%file));
|
||||
HelpFileList.entryCount++;
|
||||
}
|
||||
HelpFileList.sortNumerical(0);
|
||||
for(%i = 0; %i < HelpFileList.entryCount; %i++)
|
||||
{
|
||||
%rowId = HelpFileList.getRowId(%i);
|
||||
%text = HelpFileList.getRowTextById(%rowId);
|
||||
%text = %i + 1 @ ". " @ restWords(%text);
|
||||
HelpFileList.setRowById(%rowId, %text);
|
||||
}
|
||||
HelpFileList.setSelectedRow(0);
|
||||
}
|
||||
|
||||
function HelpFileList::onSelect(%this, %row)
|
||||
{
|
||||
%fo = new FileObject();
|
||||
%fo.openForRead(%this.fileName[%row]);
|
||||
%text = "";
|
||||
while(!%fo.isEOF())
|
||||
%text = %text @ %fo.readLine() @ "\n";
|
||||
|
||||
%fo.delete();
|
||||
HelpText.setText(%text);
|
||||
}
|
||||
|
||||
function getHelp(%helpName)
|
||||
{
|
||||
Canvas.pushDialog(HelpDlg);
|
||||
if(%helpName !$= "")
|
||||
{
|
||||
%index = HelpFileList.findTextIndex(%helpName);
|
||||
HelpFileList.setSelectedRow(%index);
|
||||
}
|
||||
}
|
||||
|
||||
function contextHelp()
|
||||
{
|
||||
for(%i = 0; %i < Canvas.getCount(); %i++)
|
||||
{
|
||||
if(Canvas.getObject(%i).getName() $= HelpDlg)
|
||||
{
|
||||
Canvas.popDialog(HelpDlg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
%content = Canvas.getContent();
|
||||
%helpPage = %content.getHelpPage();
|
||||
getHelp(%helpPage);
|
||||
}
|
||||
|
||||
function GuiControl::getHelpPage(%this)
|
||||
{
|
||||
return %this.helpPage;
|
||||
}
|
||||
|
||||
function GuiMLTextCtrl::onURL(%this, %url)
|
||||
{
|
||||
gotoWebPage( %url );
|
||||
}
|
||||
|
79
example/common/client/message.cs
Executable file
@ -0,0 +1,79 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions that process commands sent from the server.
|
||||
|
||||
|
||||
// This function is for chat messages only; it is invoked on the client when
|
||||
// the server does a commandToClient with the tag ChatMessage. (Cf. the
|
||||
// functions chatMessage* in common/server/message.cs.)
|
||||
|
||||
// This just invokes onChatMessage, which the mod code must define.
|
||||
|
||||
function clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
|
||||
{
|
||||
onChatMessage(detag(%msgString), %voice, %pitch);
|
||||
}
|
||||
|
||||
|
||||
// Game event descriptions, which may or may not include text messages, can be
|
||||
// sent using the message* functions in common/server/message.cs. Those
|
||||
// functions do commandToClient with the tag ServerMessage, which invokes the
|
||||
// function below.
|
||||
|
||||
// For ServerMessage messages, the client can install callbacks that will be
|
||||
// run, according to the "type" of the message.
|
||||
|
||||
function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
|
||||
{
|
||||
// Get the message type; terminates at any whitespace.
|
||||
%tag = getWord(%msgType, 0);
|
||||
|
||||
// First see if there is a callback installed that doesn't have a type;
|
||||
// if so, that callback is always executed when a message arrives.
|
||||
for (%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++) {
|
||||
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
|
||||
}
|
||||
|
||||
// Next look for a callback for this particular type of ServerMessage.
|
||||
if (%tag !$= "") {
|
||||
for (%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++) {
|
||||
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called by the client to install a callback for a particular type of
|
||||
// ServerMessage.
|
||||
function addMessageCallback(%msgType, %func)
|
||||
{
|
||||
for (%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++) {
|
||||
// If it already exists as a callback for this type,
|
||||
// nothing to do.
|
||||
if (%afunc $= %func) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Set it up.
|
||||
$MSGCB[%msgType, %i] = %func;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// The following is the callback that will be executed for every ServerMessage,
|
||||
// because we're going to install it without a specified type. Any type-
|
||||
// specific callbacks will be executed afterward.
|
||||
|
||||
// This just invokes onServerMessage, which the mod code must define.
|
||||
|
||||
function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
|
||||
{
|
||||
onServerMessage(detag(%msgString));
|
||||
}
|
||||
|
||||
// Register that default message handler now.
|
||||
addMessageCallback("", defaultMessageCallback);
|
108
example/common/client/messageBox.cs
Executable file
@ -0,0 +1,108 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function MessageCallback(%dlg,%callback)
|
||||
{
|
||||
Canvas.popDialog(%dlg);
|
||||
eval(%callback);
|
||||
}
|
||||
|
||||
// MBSetText resizes the message window, based on the change in size of the text
|
||||
// area.
|
||||
|
||||
function MBSetText(%text, %frame, %msg)
|
||||
{
|
||||
%ext = %text.getExtent();
|
||||
|
||||
%text.setText("<just:center>" @ %msg);
|
||||
%text.forceReflow();
|
||||
|
||||
%newExtent = %text.getExtent();
|
||||
|
||||
%deltaY = getWord(%newExtent, 1) - getWord(%ext, 1);
|
||||
%windowPos = %frame.getPosition();
|
||||
%windowExt = %frame.getExtent();
|
||||
|
||||
%frame.resize(getWord(%windowPos, 0), getWord(%windowPos, 1) - (%deltaY / 2), getWord(%windowExt, 0), getWord(%windowExt, 1) + %deltaY);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MessageBox OK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function MessageBoxOK( %title, %message, %callback )
|
||||
{
|
||||
MBOKFrame.setText( %title );
|
||||
Canvas.pushDialog( MessageBoxOKDlg );
|
||||
MBSetText(MBOKText, MBOKFrame, %message);
|
||||
MessageBoxOKDlg.callback = %callback;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxOKDlg::onSleep( %this )
|
||||
{
|
||||
%this.callback = "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// MessageBox OK/Cancel dialog:
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MessageBoxOKCancel( %title, %message, %callback, %cancelCallback )
|
||||
{
|
||||
MBOKCancelFrame.setText( %title );
|
||||
Canvas.pushDialog( MessageBoxOKCancelDlg );
|
||||
MBSetText(MBOKCancelText, MBOKCancelFrame, %message);
|
||||
MessageBoxOKCancelDlg.callback = %callback;
|
||||
MessageBoxOKCancelDlg.cancelCallback = %cancelCallback;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxOKCancelDlg::onSleep( %this )
|
||||
{
|
||||
%this.callback = "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// MessageBox Yes/No dialog:
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MessageBoxYesNo( %title, %message, %yesCallback, %noCallback )
|
||||
{
|
||||
MBYesNoFrame.setText( %title );
|
||||
Canvas.pushDialog( MessageBoxYesNoDlg );
|
||||
MBSetText(MBYesNoText, MBYesNoFrame, %message);
|
||||
MessageBoxYesNoDlg.yesCallBack = %yesCallback;
|
||||
MessageBoxYesNoDlg.noCallback = %noCallBack;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxYesNoDlg::onSleep( %this )
|
||||
{
|
||||
%this.yesCallback = "";
|
||||
%this.noCallback = "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Message popup dialog:
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function MessagePopup( %title, %message, %delay )
|
||||
{
|
||||
// Currently two lines max.
|
||||
MessagePopFrame.setText( %title );
|
||||
Canvas.pushDialog( MessagePopupDlg );
|
||||
MBSetText(MessagePopText, MessagePopFrame, %message);
|
||||
if ( %delay !$= "" )
|
||||
schedule( %delay, 0, CloseMessagePopup );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function CloseMessagePopup()
|
||||
{
|
||||
Canvas.popDialog( MessagePopupDlg );
|
||||
}
|
||||
|
157
example/common/client/metrics.cs
Executable file
@ -0,0 +1,157 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// load gui used to display various metric outputs
|
||||
exec("~/ui/FrameOverlayGui.gui");
|
||||
|
||||
|
||||
function fpsMetricsCallback()
|
||||
{
|
||||
return " FPS: " @ $fps::real @
|
||||
" mspf: " @ 1000 / $fps::real;
|
||||
}
|
||||
|
||||
function terrainMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Terrain -" @
|
||||
" L0: " @ $T2::levelZeroCount @
|
||||
" FMC: " @ $T2::fullMipCount @
|
||||
" DTC: " @ $T2::dynamicTextureCount @
|
||||
" UNU: " @ $T2::unusedTextureCount @
|
||||
" STC: " @ $T2::staticTextureCount @
|
||||
" DTSU: " @ $T2::textureSpaceUsed @
|
||||
" STSU: " @ $T2::staticTSU @
|
||||
" FRB: " @ $T2::FogRejections;
|
||||
}
|
||||
|
||||
function videoMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Video -" @
|
||||
" TC: " @ $OpenGL::triCount0 + $OpenGL::triCount1 + $OpenGL::triCount2 + $OpenGL::triCount3 @
|
||||
" PC: " @ $OpenGL::primCount0 + $OpenGL::primCount1 + $OpenGL::primCount2 + $OpenGL::primCount3 @
|
||||
" T_T: " @ $OpenGL::triCount1 @
|
||||
" T_P: " @ $OpenGL::primCount1 @
|
||||
" I_T: " @ $OpenGL::triCount2 @
|
||||
" I_P: " @ $OpenGL::primCount2 @
|
||||
" TS_T: " @ $OpenGL::triCount3 @
|
||||
" TS_P: " @ $OpenGL::primCount3 @
|
||||
" ?_T: " @ $OpenGL::triCount0 @
|
||||
" ?_P: " @ $OpenGL::primCount0;
|
||||
}
|
||||
|
||||
function interiorMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Interior --" @
|
||||
" NTL: " @ $Video::numTexelsLoaded @
|
||||
" TRP: " @ $Video::texResidentPercentage @
|
||||
" INP: " @ $Metrics::Interior::numPrimitives @
|
||||
" INT: " @ $Matrics::Interior::numTexturesUsed @
|
||||
" INO: " @ $Metrics::Interior::numInteriors;
|
||||
}
|
||||
|
||||
function textureMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Texture --"@
|
||||
" NTL: " @ $Video::numTexelsLoaded @
|
||||
" TRP: " @ $Video::texResidentPercentage @
|
||||
" TCM: " @ $Video::textureCacheMisses;
|
||||
}
|
||||
|
||||
function waterMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Water --"@
|
||||
" Tri#: " @ $T2::waterTriCount @
|
||||
" Pnt#: " @ $T2::waterPointCount @
|
||||
" Hz#: " @ $T2::waterHazePointCount;
|
||||
}
|
||||
|
||||
function timeMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Time -- " @
|
||||
" Sim Time: " @ getSimTime() @
|
||||
" Mod: " @ getSimTime() % 32;
|
||||
}
|
||||
|
||||
function vehicleMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Vehicle --"@
|
||||
" R: " @ $Vehicle::retryCount @
|
||||
" C: " @ $Vehicle::searchCount @
|
||||
" P: " @ $Vehicle::polyCount @
|
||||
" V: " @ $Vehicle::vertexCount;
|
||||
}
|
||||
|
||||
function audioMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Audio --"@
|
||||
" OH: " @ $Audio::numOpenHandles @
|
||||
" OLH: " @ $Audio::numOpenLoopingHandles @
|
||||
" AS: " @ $Audio::numActiveStreams @
|
||||
" NAS: " @ $Audio::numNullActiveStreams @
|
||||
" LAS: " @ $Audio::numActiveLoopingStreams @
|
||||
" LS: " @ $Audio::numLoopingStreams @
|
||||
" ILS: " @ $Audio::numInactiveLoopingStreams @
|
||||
" CLS: " @ $Audio::numCulledLoopingStreams;
|
||||
}
|
||||
|
||||
function debugMetricsCallback()
|
||||
{
|
||||
return fpsMetricsCallback() @
|
||||
" Debug --"@
|
||||
" NTL: " @ $Video::numTexelsLoaded @
|
||||
" TRP: " @ $Video::texResidentPercentage @
|
||||
" NP: " @ $Metrics::numPrimitives @
|
||||
" NT: " @ $Metrics::numTexturesUsed @
|
||||
" NO: " @ $Metrics::numObjectsRendered;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function metrics(%expr)
|
||||
{
|
||||
switch$(%expr)
|
||||
{
|
||||
case "audio": %cb = "audioMetricsCallback()";
|
||||
case "debug": %cb = "debugMetricsCallback()";
|
||||
case "interior":
|
||||
$fps::virtual = 0;
|
||||
$Interior::numPolys = 0;
|
||||
$Interior::numTextures = 0;
|
||||
$Interior::numTexels = 0;
|
||||
$Interior::numLightmaps = 0;
|
||||
$Interior::numLumels = 0;
|
||||
%cb = "interiorMetricsCallback()";
|
||||
|
||||
case "fps": %cb = "fpsMetricsCallback()";
|
||||
case "time": %cb = "timeMetricsCallback()";
|
||||
case "terrain": %cb = "terrainMetricsCallback()";
|
||||
case "texture":
|
||||
GLEnableMetrics(true);
|
||||
%cb = "textureMetricsCallback()";
|
||||
|
||||
case "video": %cb = "videoMetricsCallback()";
|
||||
case "vehicle": %cb = "vehicleMetricsCallback()";
|
||||
case "water": %cb = "waterMetricsCallback()";
|
||||
}
|
||||
|
||||
if (%cb !$= "")
|
||||
{
|
||||
Canvas.pushDialog(FrameOverlayGui, 1000);
|
||||
TextOverlayControl.setValue(%cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLEnableMetrics(false);
|
||||
Canvas.popDialog(FrameOverlayGui);
|
||||
}
|
||||
}
|
26
example/common/client/mission.cs
Executable file
@ -0,0 +1,26 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Mission start / end events sent from the server
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function clientCmdMissionStart(%seq)
|
||||
{
|
||||
// The client recieves a mission start right before
|
||||
// being dropped into the game.
|
||||
}
|
||||
|
||||
function clientCmdMissionEnd(%seq)
|
||||
{
|
||||
// Recieved when the current mission is ended.
|
||||
alxStopAll();
|
||||
|
||||
// Disable mission lighting if it's going, this is here
|
||||
// in case the mission ends while we are in the process
|
||||
// of loading it.
|
||||
$lightingMission = false;
|
||||
$sceneLighting::terminateLighting = true;
|
||||
}
|
110
example/common/client/missionDownload.cs
Executable file
@ -0,0 +1,110 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Mission Loading
|
||||
// Server download handshaking. This produces a number of onPhaseX
|
||||
// calls so the game scripts can update the game's GUI.
|
||||
//
|
||||
// Loading Phases:
|
||||
// Phase 1: Download Datablocks
|
||||
// Phase 2: Download Ghost Objects
|
||||
// Phase 3: Scene Lighting
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Phase 1
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function clientCmdMissionStartPhase1(%seq, %missionName, %musicTrack)
|
||||
{
|
||||
// These need to come after the cls.
|
||||
echo ("*** New Mission: " @ %missionName);
|
||||
echo ("*** Phase 1: Download Datablocks & Targets");
|
||||
onMissionDownloadPhase1(%missionName, %musicTrack);
|
||||
commandToServer('MissionStartPhase1Ack', %seq);
|
||||
}
|
||||
|
||||
function onDataBlockObjectReceived(%index, %total)
|
||||
{
|
||||
onPhase1Progress(%index / %total);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Phase 2
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function clientCmdMissionStartPhase2(%seq,%missionName)
|
||||
{
|
||||
onPhase1Complete();
|
||||
echo ("*** Phase 2: Download Ghost Objects");
|
||||
purgeResources();
|
||||
onMissionDownloadPhase2(%missionName);
|
||||
commandToServer('MissionStartPhase2Ack', %seq);
|
||||
}
|
||||
|
||||
function onGhostAlwaysStarted(%ghostCount)
|
||||
{
|
||||
$ghostCount = %ghostCount;
|
||||
$ghostsRecvd = 0;
|
||||
}
|
||||
|
||||
function onGhostAlwaysObjectReceived()
|
||||
{
|
||||
$ghostsRecvd++;
|
||||
onPhase2Progress($ghostsRecvd / $ghostCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Phase 3
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function clientCmdMissionStartPhase3(%seq,%missionName)
|
||||
{
|
||||
onPhase2Complete();
|
||||
StartClientReplication();
|
||||
StartFoliageReplication();
|
||||
echo ("*** Phase 3: Mission Lighting");
|
||||
$MSeq = %seq;
|
||||
$Client::MissionFile = %missionName;
|
||||
|
||||
// Need to light the mission before we are ready.
|
||||
// The sceneLightingComplete function will complete the handshake
|
||||
// once the scene lighting is done.
|
||||
if (lightScene("sceneLightingComplete", ""))
|
||||
{
|
||||
error("Lighting mission....");
|
||||
schedule(1, 0, "updateLightingProgress");
|
||||
onMissionDownloadPhase3(%missionName);
|
||||
$lightingMission = true;
|
||||
}
|
||||
}
|
||||
|
||||
function updateLightingProgress()
|
||||
{
|
||||
onPhase3Progress($SceneLighting::lightingProgress);
|
||||
if ($lightingMission)
|
||||
$lightingProgressThread = schedule(1, 0, "updateLightingProgress");
|
||||
}
|
||||
|
||||
function sceneLightingComplete()
|
||||
{
|
||||
echo("Mission lighting done");
|
||||
onPhase3Complete();
|
||||
|
||||
// The is also the end of the mission load cycle.
|
||||
onMissionDownloadComplete();
|
||||
commandToServer('MissionStartPhase3Ack', $MSeq);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Helper functions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function connect(%server)
|
||||
{
|
||||
%conn = new GameConnection();
|
||||
%conn.connect(%server);
|
||||
}
|
111
example/common/client/recordings.cs
Executable file
@ -0,0 +1,111 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// RecordingsGui is the main TSControl through which the a demo game recording
|
||||
// is viewed.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function recordingsDlg::onWake()
|
||||
{
|
||||
RecordingsDlgList.clear();
|
||||
%i = 0;
|
||||
%filespec = $currentMod @ "/recordings/*.rec";
|
||||
echo(%filespec);
|
||||
for(%file = findFirstFile(%filespec); %file !$= ""; %file = findNextFile(%filespec))
|
||||
{
|
||||
%fileName = fileBase(%file);
|
||||
if (strStr(%file, "/CVS/") == -1)
|
||||
{
|
||||
RecordingsDlgList.addRow(%i++, %fileName);
|
||||
}
|
||||
}
|
||||
RecordingsDlgList.sort(0);
|
||||
RecordingsDlgList.setSelectedRow(0);
|
||||
RecordingsDlgList.scrollVisible(0);
|
||||
}
|
||||
|
||||
function StartSelectedDemo()
|
||||
{
|
||||
// first unit is filename
|
||||
%sel = RecordingsDlgList.getSelectedId();
|
||||
%rowText = RecordingsDlgList.getRowTextById(%sel);
|
||||
|
||||
%file = $currentMod @ "/recordings/" @ getField(%rowText, 0) @ ".rec";
|
||||
|
||||
new GameConnection(ServerConnection);
|
||||
RootGroup.add(ServerConnection);
|
||||
|
||||
if(ServerConnection.playDemo(%file))
|
||||
{
|
||||
Canvas.setContent(PlayGui);
|
||||
Canvas.popDialog(RecordingsDlg);
|
||||
ServerConnection.prepDemoPlayback();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxOK("Playback Failed", "Demo playback failed for file '" @ %file @ "'.");
|
||||
if (isObject(ServerConnection)) {
|
||||
ServerConnection.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startDemoRecord()
|
||||
{
|
||||
// make sure that current recording stream is stopped
|
||||
ServerConnection.stopRecording();
|
||||
|
||||
// make sure we aren't playing a demo
|
||||
if(ServerConnection.isDemoPlaying())
|
||||
return;
|
||||
|
||||
for(%i = 0; %i < 1000; %i++)
|
||||
{
|
||||
%num = %i;
|
||||
if(%num < 10)
|
||||
%num = "0" @ %num;
|
||||
if(%num < 100)
|
||||
%num = "0" @ %num;
|
||||
|
||||
%file = $currentMod @ "/recordings/demo" @ %num @ ".rec";
|
||||
if(!isfile(%file))
|
||||
break;
|
||||
}
|
||||
if(%i == 1000)
|
||||
return;
|
||||
|
||||
$DemoFileName = %file;
|
||||
|
||||
ChatHud.AddLine( "\c4Recording to file [\c2" @ $DemoFileName @ "\cr].");
|
||||
|
||||
ServerConnection.prepDemoRecord();
|
||||
ServerConnection.startRecording($DemoFileName);
|
||||
|
||||
// make sure start worked
|
||||
if(!ServerConnection.isDemoRecording())
|
||||
{
|
||||
deleteFile($DemoFileName);
|
||||
ChatHud.AddLine( "\c3 *** Failed to record to file [\c2" @ $DemoFileName @ "\cr].");
|
||||
$DemoFileName = "";
|
||||
}
|
||||
}
|
||||
|
||||
function stopDemoRecord()
|
||||
{
|
||||
// make sure we are recording
|
||||
if(ServerConnection.isDemoRecording())
|
||||
{
|
||||
ChatHud.AddLine( "\c4Recording file [\c2" @ $DemoFileName @ "\cr] finished.");
|
||||
ServerConnection.stopRecording();
|
||||
}
|
||||
}
|
||||
|
||||
function demoPlaybackComplete()
|
||||
{
|
||||
disconnect();
|
||||
Canvas.setContent("MainMenuGui");
|
||||
Canvas.pushDialog(RecordingsDlg);
|
||||
}
|
80
example/common/client/screenshot.cs
Executable file
@ -0,0 +1,80 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
function formatImageNumber(%number)
|
||||
{
|
||||
if(%number < 10)
|
||||
%number = "0" @ %number;
|
||||
if(%number < 100)
|
||||
%number = "0" @ %number;
|
||||
if(%number < 1000)
|
||||
%number = "0" @ %number;
|
||||
if(%number < 10000)
|
||||
%number = "0" @ %number;
|
||||
return %number;
|
||||
}
|
||||
|
||||
function formatSessionNumber(%number)
|
||||
{
|
||||
if(%number < 10)
|
||||
%number = "0" @ %number;
|
||||
if(%number < 100)
|
||||
%number = "0" @ %number;
|
||||
return %number;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
function recordMovie(%movieName, %fps)
|
||||
{
|
||||
$timeAdvance = 1000 / %fps;
|
||||
$screenGrabThread = schedule($timeAdvance,0,movieGrabScreen,%movieName,0);
|
||||
}
|
||||
|
||||
function movieGrabScreen(%movieName, %frameNumber)
|
||||
{
|
||||
screenshot(%movieName @ formatImageNumber(%frameNumber) @ ".png");
|
||||
$screenGrabThread = schedule($timeAdvance, 0, movieGrabScreen, %movieName, %frameNumber + 1);
|
||||
}
|
||||
|
||||
function stopMovie()
|
||||
{
|
||||
$timeAdvance = 0;
|
||||
cancel($screenGrabThread);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
$screenshotNumber = 0;
|
||||
|
||||
function doScreenShot( %val )
|
||||
{
|
||||
if (%val)
|
||||
{
|
||||
if ($pref::Video::screenShotSession $= "")
|
||||
$pref::Video::screenShotSession = 0;
|
||||
if ($screenshotNumber == 0)
|
||||
$pref::Video::screenShotSession++;
|
||||
if ($pref::Video::screenShotSession > 999)
|
||||
$pref::Video::screenShotSession = 1;
|
||||
|
||||
$pref::interior::showdetailmaps = false;
|
||||
$name = "screenshot_" @ formatSessionNumber($pref::Video::screenShotSession) @ "-" @ formatImageNumber($screenshotNumber++);
|
||||
|
||||
if($pref::Video::screenShotFormat $= "JPEG")
|
||||
screenShot($name @ ".jpg", "JPEG");
|
||||
else
|
||||
if($pref::Video::screenShotFormat $= "PNG")
|
||||
screenShot($name @ ".png", "PNG");
|
||||
else
|
||||
screenShot($name @ ".png", "PNG");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// bind key to take screenshots
|
||||
GlobalActionMap.bind(keyboard, "ctrl p", doScreenShot);
|
||||
|
19
example/common/client/scriptDoc.cs
Executable file
@ -0,0 +1,19 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Writes out all script functions to a file
|
||||
function writeOutFunctions() {
|
||||
new ConsoleLogger( logger, "scriptFunctions.txt", false );
|
||||
dumpConsoleFunctions();
|
||||
logger.delete();
|
||||
}
|
||||
|
||||
// Writes out all script classes to a file
|
||||
function writeOutClasses() {
|
||||
new ConsoleLogger( logger, "scriptClasses.txt", false );
|
||||
dumpConsoleClasses();
|
||||
logger.delete();
|
||||
}
|
6
example/common/help/10. Terrain Texture Painter.hfl
Executable file
@ -0,0 +1,6 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Terrain Texture Painter...<font:Arial:16>
|
||||
|
||||
The Terrain Texture Painter tool is used to manually paint terrain textures on the terrain. Users can select up to six different textures in the boxes in the upper right corner of the screen. Selecting a texture will place a black box around it. The terrain brush can then be used to paint the texture on the terrain.
|
||||
|
||||
Terrains with more than four textures may exhibit rendering irregularities if all those textures are used in the same area of a map. In general it is wise to use four or fewer textures on any individual terrain map.
|
||||
|
8
example/common/help/2. License.hfl
Executable file
@ -0,0 +1,8 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Torque Game Engine Licenses<font:Arial:16>
|
||||
|
||||
For information about Torque Game Engine Licenses please visit our website.
|
||||
|
||||
<a:www.garagegames.com/pg/product/view.php?id=1>Torque Game Engine - Indie License</a>
|
||||
<a:www.garagegames.com/pg/product/view.php?id=31>Torque Game Engine - Commercial Use License</a>
|
||||
|
||||
|
42
example/common/help/3. Gui Editor.hfl
Executable file
@ -0,0 +1,42 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Gui Editor...
|
||||
|
||||
GUI Editor Basics<font:Arial:16>
|
||||
This description covers the basics of using the GUI Editor. For detailed documentation and tutorials see the <a:www.garagegames.com/mg/projects/tge/>Torque Home Page</a>
|
||||
|
||||
Press the F10 key on the keyboard to toggle the GUI Editor on and off. The GUI Editor will start editing the current main content control, minus any dialogs that may be visible.
|
||||
|
||||
The GUI Editor is broken up into four main visual components. In the upper left portion of the screen is the content editor, where controls can be placed, moved and resized. In the upper right is the tree, that shows the current content control hierarchy. The lower left panel is the tool bar, which contains functions for aligning, and spacing controls as well as creating new controls and screens. The lower right pane is the inspector, where the currently selected control's attributes are displayed.
|
||||
|
||||
<font:Arial Bold:20>Mouse Editing<font:Arial:16>
|
||||
Left clicking the mouse on a control in the content editor selects that control. Once selected, a control can be moved by clicking and dragging its content area, or resized using one of the 8 black sizing knobs. Shift-clicking on several controls allows the user to select more than one control at once. In this case, the sizing knobs turn white, and can no longer be used to size the control, but the controls can still be moved by dragging. Only controls that share the same parent can be selected at the same time.
|
||||
|
||||
The parent control of the currently selected control is outlined with a yellow and blue band. This control is known as the <spush><font:Arial Bold:16>Current Add Parent<spop>. Any new control created from the toolbar or pasted from the clipboard will be added to this control. The Current Add Parent control can be set manually by either left-clicking one of its children, or right-clicking the control itself.
|
||||
|
||||
<font:Arial Bold:20>Keyboard Commands<font:Arial:16>
|
||||
The editor supports several keyboard commands and shortcuts:
|
||||
|
||||
<spush><font:Arial Bold:16>Control-A<spop> - Select All. Selects all the controls in the Current Add Parent.
|
||||
<spush><font:Arial Bold:16>Control-C<spop> - Copy. Copys the currently selected control(s) to the clipboard.
|
||||
<spush><font:Arial Bold:16>Control-X<spop> - Cut. Cuts the currently selected control(s) to the clipboard.
|
||||
<spush><font:Arial Bold:16>Control-V<spop> - Paste. Pastes any control(s) on the clipboard into the Current Add Parent.
|
||||
<spush><font:Arial Bold:16>Arrow Keys<spop> - Movement. Moves the current control selection one pixel in the direction of the arrow.
|
||||
<spush><font:Arial Bold:16>Shift-Arrow Keys<spop> - Movement. Moves the current control selection ten pixels in the direction of the arrow.
|
||||
<spush><font:Arial Bold:16>Delete/Backspace<spop> - Delete. Deletes the current control selection.
|
||||
|
||||
<font:Arial Bold:20>Toolbar Commands<font:Arial:16>
|
||||
The toolbar has several command buttons that operate on the current selection set and creating and saving guis, as well as pop-up menus for creating new controls and changing the currently edited gui. The functions of the buttons are described below:
|
||||
|
||||
<spush><font:Arial Bold:16>Align Left<spop> - Aligns the left edge of all controls in the current selection set to the leftmost point of any of the selected controls.
|
||||
<spush><font:Arial Bold:16>Align Right<spop> - Aligns the right edge of all controls in the current selection set to the rightmost point of any of the selected controls.
|
||||
<spush><font:Arial Bold:16>Center Horiz<spop> - Centers horizontally all selected controls in the rectangle bounded by the current selection set.
|
||||
<spush><font:Arial Bold:16>Align Top<spop> - Aligns the top edge of all controls in the current selection set to the topmost point of any of the selected controls.
|
||||
<spush><font:Arial Bold:16>Align Bottom<spop> - Aligns the bottom edge of all controls in the current selection set to the bottommost point of any of the selected controls.
|
||||
<spush><font:Arial Bold:16>Help<spop> - Displays this help dialog.
|
||||
<spush><font:Arial Bold:16>Space Vert<spop> - Evenly spaces vertically all selected controls.
|
||||
<spush><font:Arial Bold:16>Space Horiz<spop> - Evenly spaces horizontally all selected controls.
|
||||
<spush><font:Arial Bold:16>Bring Front<spop> - Moves the selected control in front of its sibling controls.
|
||||
<spush><font:Arial Bold:16>Send Back<spop> - Moves the selected control behind its sibling controls.
|
||||
<spush><font:Arial Bold:16>New...<spop> - Brings up a dialog that allows the user to create and name a new control for editing.
|
||||
<spush><font:Arial Bold:16>Save<spop> - Brings up a dialog that allows the user to save the current content control to a file.
|
||||
<spush><font:Arial Bold:16>New Control (popup)<spop> - Displays a list of all controls that the user can create to add to the current content control.
|
||||
<spush><font:Arial Bold:16>Show GUI (popup)<spop> - Displays the name of the gui currently being edited. Selecting this popup allows the user to choose a screen to edit from all loaded guis.
|
50
example/common/help/4. Mission Editor Overview.hfl
Executable file
@ -0,0 +1,50 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Mission Editor...
|
||||
|
||||
Mission Editor Overview<font:Arial:16>
|
||||
This description covers the basics of using the World Editor. For detailed documentation and tutorials see the <a:www.garagegames.com/mg/projects/tge/>Torque Home Page</a>
|
||||
|
||||
The Mission Editor is the in-game tool for creating and editing landscapes and placing objects in the 3D world.
|
||||
|
||||
Press the F11 key while in the game to toggle the Mission Editor on and off. The mission editor will start editing the currently loaded mission.
|
||||
|
||||
The Mission Editor is composed of the following tools, selectable from the Window menu:
|
||||
<font:Arial Bold:16>World Editor<font:Arial:16> - Full screen object movement and selection.
|
||||
<font:Arial Bold:16>World Editor Inspector<font:Arial:16> - Used to inspect the properties of mission objects
|
||||
<font:Arial Bold:16>World Editor Creator<font:Arial:16> - Used to create new mission objects
|
||||
<font:Arial Bold:16>Mission Area Editor<font:Arial:16> - Used to adjust the bounds of the mission area, as well as mirror terrain data
|
||||
<font:Arial Bold:16>Terrain Editor<font:Arial:16> - Tool for manually adjusting the terrain heightfield and square properties
|
||||
<font:Arial Bold:16>Terrain Terraform Editor<font:Arial:16> - Tool for procedurally generating the terrain heightfield from fractal operations
|
||||
<font:Arial Bold:16>Terrain Texture Editor<font:Arial:16> - Tool for procedurally generating the terrain textures based on rules
|
||||
<font:Arial Bold:16>Terrain Texture Painter<font:Arial:16> - Tool for manually painting terrain textures on the terrain
|
||||
|
||||
There are several editor functions and menus that are available in all mission editor modes:
|
||||
|
||||
<font:Arial Bold:20>Basic Movement<font:Arial:16>
|
||||
The normal movement keys can be used to control both the player and the camera. The right mouse button is used to rotate the camera or adjust the player's view.
|
||||
|
||||
<font:Arial Bold:20>File Menu<font:Arial:16>
|
||||
<font:Arial Bold:16>New Mission...<font:Arial:16> - Creates a new empty mission with a default terrain and sky
|
||||
<font:Arial Bold:16>Open Mission...<font:Arial:16> - Opens an existing mission for editing
|
||||
<font:Arial Bold:16>Save Mission<font:Arial:16> - Saves changes to the current mission to disk
|
||||
<font:Arial Bold:16>Save Mission As...<font:Arial:16> - Saves the current mission under a new name
|
||||
<font:Arial Bold:16>Import Terraform Data...<font:Arial:16> - Imports terraform rules from an existing terrain file
|
||||
<font:Arial Bold:16>Import Texture Data...<font:Arial:16> - Imports terrain texture rules from an existing terrain file
|
||||
<font:Arial Bold:16>Export Terraform Bitmap...<font:Arial:16> - Only active from the Terrain Terraform Editor - exports the current terraform map to a bitmap
|
||||
|
||||
<font:Arial Bold:20>Edit Menu<font:Arial:16>
|
||||
<font:Arial Bold:16>Undo<font:Arial:16> - Undoes the last action in terrain or world editing. Not all actions can be undone
|
||||
<font:Arial Bold:16>Redo<font:Arial:16> - Redoes the last undone action
|
||||
<font:Arial Bold:16>Cut<font:Arial:16> - Cuts the selected objects in the world editor from the mission to the clipboard
|
||||
<font:Arial Bold:16>Copy<font:Arial:16> - Copys the selected objects in the world editor to the clipboard
|
||||
<font:Arial Bold:16>Paste<font:Arial:16> - Pastes the current clipboard contents into the mission
|
||||
<font:Arial Bold:16>Select All<font:Arial:16> - Selects all mission objects in the world editor
|
||||
<font:Arial Bold:16>Select None<font:Arial:16> - Clears the current selection in the world and terrain editors
|
||||
<font:Arial Bold:16>Relight Scene<font:Arial:16> - Recomputes mission static lighting
|
||||
<font:Arial Bold:16>World Editor Settings...<font:Arial:16> - Accesses the settings dialog for the World Editor
|
||||
<font:Arial Bold:16>Terrain Editor Settings...<font:Arial:16> - Accesses the settings dialog for the Terrain Editor
|
||||
|
||||
<font:Arial Bold:20>Camera Menu<font:Arial:16>
|
||||
<font:Arial Bold:16>Drop Camera At Player<font:Arial:16> - Moves the camera object to the location of the player, and sets the mode to camera movement mode
|
||||
<font:Arial Bold:16>Drop Player At Camera<font:Arial:16> - Moves the player object to the location of the movable camera, and sets the mode to player movement mode
|
||||
<font:Arial Bold:16>Toggle Camera<font:Arial:16> - Toggles between player and camera movement mode
|
||||
<font:Arial Bold:16>Slowest...Fastest<font:Arial:16> - Adjusts the speed of the camera
|
53
example/common/help/5. World Editor.hfl
Executable file
@ -0,0 +1,53 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>World Editor...
|
||||
|
||||
World Editor Basics<font:Arial:16>
|
||||
The World Editor has three seperate "windows" in the Mission Editor:
|
||||
World Editor - a full screen object manipulator
|
||||
World Editor Inspector - used for inspecting and editing the properties of objects
|
||||
World Editor Creator - used for creating new mission objects
|
||||
|
||||
The World Editor main view is a view of the 3D world. Objects in this view (interiors, shapes, markers, etc) can be manipulated with the mouse and keyboard.
|
||||
|
||||
The following mouse and keyboard functions exist:
|
||||
|
||||
<font:Arial Bold Italic:16>Clicking on an unselected object<font:Arial:16> - deselects all currently selected objects and selects the clicked object
|
||||
<font:Arial Bold Italic:16>Clicking in empty space<font:Arial:16> - click-drags a box around objects, and selects all objects in the box
|
||||
<font:Arial Bold Italic:16>Shift-clicking on an object<font:Arial:16> - toggles selection of the clicked object
|
||||
<font:Arial Bold Italic:16>Mouse dragging a selected object<font:Arial:16> - moves the selected objects, either on a horizontal plane, or sticking to the terrain, depending on the setting of the "Planar Movement" checkbox in the World Editor Settings dialog
|
||||
<font:Arial Bold Italic:16>Control-clicking and drag<font:Arial:16> - moves the selected objects vertically
|
||||
<font:Arial Bold Italic:16>Alt-clicking and drag<font:Arial:16> - rotates the selected objects about the vertical axis
|
||||
<font:Arial Bold Italic:16>Alt-control-clicking and drag<font:Arial:16> - scales the selected object by a face on the bounding box
|
||||
|
||||
If gizmos are enabled in the World Editor Settings dialog, they can also be clicked and dragged:
|
||||
<font:Arial Bold Italic:16>click-drag gizmo axis<font:Arial:16> - move selection along that axis
|
||||
<font:Arial Bold Italic:16>alt-click-drag gizmo axis<font:Arial:16> - rotate selection on that axis
|
||||
<font:Arial Bold Italic:16>alt-control-click-drag gizmo axis<font:Arial:16> - scale along that axis
|
||||
|
||||
<font:Arial Bold:20>World Menu<font:Arial:16>
|
||||
The World Menu contains world editor specific options for controlling properties of the current selection, as well as choosing where new objects are dropped. The following list describes the world menu options:
|
||||
<font:Arial Bold:16>Lock Selection<font:Arial:16> - Locks the current selection so that it cannot be manipulated from the world editor view
|
||||
<font:Arial Bold:16>Unlock Selection<font:Arial:16> - Unlocks a locked selection
|
||||
<font:Arial Bold:16>Hide Selection<font:Arial:16> - Hides the current selection to reduce clutter while editing
|
||||
<font:Arial Bold:16>Show Selection<font:Arial:16> - Shows hidden objects in the selection
|
||||
<font:Arial Bold:16>Delete Selection<font:Arial:16> - Deletes the currently selected objects
|
||||
<font:Arial Bold:16>Camera To Selection<font:Arial:16> - Moves the camera to the selected objects
|
||||
<font:Arial Bold:16>Reset Transforms<font:Arial:16> - Resets the rotation and scale on the selected objects
|
||||
<font:Arial Bold:16>Drop Selection<font:Arial:16> - Re-drops the selected objects into the mission according to the drop rule (see below)
|
||||
<font:Arial Bold:16>Add Selection to Instant Group<font:Arial:16> - Moves the currently selected objects into the current Instant Group.
|
||||
<font:Arial Bold:16>Drop at Origin<font:Arial:16> - New objects will be created at the origin
|
||||
<font:Arial Bold:16>Drop at Camera<font:Arial:16> - New objects will be created at the camera's location
|
||||
<font:Arial Bold:16>Drop at Camera w/Rot<font:Arial:16> - New objects will be created at the camera's location with the camera's current orientation
|
||||
<font:Arial Bold:16>Drop below Camera<font:Arial:16> - New objects will be created below the camera's location
|
||||
<font:Arial Bold:16>Drop at Screen Center<font:Arial:16> - New objects will be created in the world where the view direction hits an object
|
||||
<font:Arial Bold:16>Drop at Centroid<font:Arial:16> - New objects will be created in the world at the center of the selection
|
||||
<font:Arial Bold:16>Drop to Ground<font:Arial:16> - New objects will be dropped at the terrain ground level
|
||||
|
||||
<font:Arial Bold:20>World Editor Tree<font:Arial:16>
|
||||
The World Editor tree view is displayed in the upper right screen quadrant in both the World Editor Inspector and the World Editor Creator. This tree displays the hierarchy of the mission data file. Objects selected in the tree will also be selected in the main view. There is a special group selection call the <font:Arial Bold:16>Instant Group<font:Arial:16>. This group is where objects that are pasted are placed, as well as where objects created from the World Editor Creator are placed. In the World Editor tree view the instant group is displayed with a grey hilight. To change the current instant group, Alt-click on a group in the tree view.
|
||||
|
||||
<font:Arial Bold:20>World Editor Inspector<font:Arial:16>
|
||||
The World Editor Inspector allows the user to specify properties of mission objects. When an object is selected in Inspector mode, that object's properties will be displayed in the lower right quadrant of the screen. Once properties are edited, clicking the apply button will set those properties into the object. Dynamic properties can be assigned to objects with the Dynamic Fields Add button. Dynamic fields are accessable through the scripting language and are used to add game-specific properties to mission objects.
|
||||
|
||||
<font:Arial Bold:20>World Editor Creator<font:Arial:16>
|
||||
The World Editor Creator displays a tree view in the lower left corner of the screen. This tree contains all objects that can be created in a mission.
|
||||
|
9
example/common/help/6. Mission Area Editor.hfl
Executable file
@ -0,0 +1,9 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Mission Area Editor...<font:Arial:16>
|
||||
|
||||
The Mission Area Editor displays an overhead height map in the upper right corner of the screen, with markers for mission objects, a box for the mission area and a pair of lines denoting the current field of view. Clicking anywhere on the display will move the current view object (either camera or player) to that location in the mission.
|
||||
|
||||
To edit the mission area, click on the "Edit Area" checkbox. This will display 8 resizing knobs on the mission area box, that can be dragged with the mouse.
|
||||
|
||||
The "Center" button will cause the terrain file data to be repositioned and centered at 0,0 in the center of the mission area box.
|
||||
|
||||
To mirror the terrain, click on the Mirror button. This will put the mission area editor in mirror mode. The left and right arrow buttons adjust the mirror plane angle to one of 8 different angles (2 axis aligned, 2 45-degree splits), and the Apply button will mirror the terrain across the mirror plane.
|
17
example/common/help/7. Terrain Editor.hfl
Executable file
@ -0,0 +1,17 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Terrain Editor...<font:Arial:16>
|
||||
|
||||
The terrain editor is used to manually modify the terrain height map and square properties. Terrain editing is accomplished using the brush. The brush is a selection of terrain points or squares centered around the mouse cursor. The brush is either a circle or square area, and can be one of several size selected from the brush menu. The brush can also be either a hard brush - where the affect on the terrain is the same across the surface of the brush - or a soft brush - where the brush's influence on terrain diminishes towards the edges of the brush. The Terrain Editor Settings dialog filter view controls the falloff of the soft brush.
|
||||
|
||||
The following terrain editing action modes can be selected from the <font:Arial Bold:16>Action<font:Arial:16> menu.
|
||||
<font:Arial Bold:16>Select<font:Arial:16> - Painting with the brush selects grid points
|
||||
<font:Arial Bold:16>Adjust Selection<font:Arial:16> - The currently selected grid points can be raised or lowered as a group
|
||||
<font:Arial Bold:16>Add Dirt<font:Arial:16> - "Dirt" is added at the center of the brush
|
||||
<font:Arial Bold:16>Excavate<font:Arial:16> - "Dirt" is removed from the center of the brush
|
||||
<font:Arial Bold:16>Ajust Height<font:Arial:16> - The brush selection can be dragged to raise or lower it
|
||||
<font:Arial Bold:16>Flatten<font:Arial:16> - The brush surface is set to a flat plane height
|
||||
<font:Arial Bold:16>Smooth<font:Arial:16> - Rough areas are made more smooth in the bounds of the brush
|
||||
<font:Arial Bold:16>Set Height<font:Arial:16> - The terrain within the brush is set to a constant height (configurable in the Terrain Editor Settings)
|
||||
<font:Arial Bold:16>Set Empty<font:Arial:16> - The squares covered by the brush are made into holes in the terrain
|
||||
<font:Arial Bold:16>Clear Empty<font:Arial:16> - The squares covered by the brush are made solid
|
||||
<font:Arial Bold:16>Paint Material<font:Arial:16> - The current terrain texture material will be painted with the brush
|
||||
|
21
example/common/help/8. Terrain Terraform Editor.hfl
Executable file
@ -0,0 +1,21 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Terrain Terraform Editor...<font:Arial:16>
|
||||
|
||||
The Terrain Terraform Editor is used to algorithmically generate terrain heightfields. Heightfield operations are arranged in a stack, with some operations using the results of previous operations to produce new heightfields. The results of the last operation on the stack can be applied to the terrain using the Apply button.
|
||||
|
||||
The Terraform Editor has two panes - the top pane displays information about the currently selected operation, and the bottom pane shows the current operation stack. Between the two is a pull down menu for the creation of new operations. The first operation in the stack is always the General operation (which can't be deleted).
|
||||
|
||||
The following operations are supported in the editor:
|
||||
<font:Arial Bold:16>fBm Fractal<font:Arial:16> - Fractal for creating bumpy hills
|
||||
<font:Arial Bold:16>Rigid Multifractal<font:Arial:16> - Fractal for creating ridges and sweeping valleys
|
||||
<font:Arial Bold:16>Canyon Fractal<font:Arial:16> - Fractal for creating vertical canyon ridges
|
||||
<font:Arial Bold:16>Sinus<font:Arial:16> - Overlapping sine wave patterns with different frequencies useful for creating rolling hills
|
||||
<font:Arial Bold:16>Bitmap<font:Arial:16> - Used to import an existing 256x256 bitmap as a heightfield
|
||||
<font:Arial Bold:16>Turbulence<font:Arial:16> - perturbs another operation on the stack
|
||||
<font:Arial Bold:16>Smoothing<font:Arial:16> - smooths another operation on the stack
|
||||
<font:Arial Bold:16>Smooth Water<font:Arial:16> - smooths water
|
||||
<font:Arial Bold:16>Smooth Ridges/valleys<font:Arial:16> - smooths an existing operation on edge boundaries
|
||||
<font:Arial Bold:16>Filter<font:Arial:16> - filters an existing operation based on a curve
|
||||
<font:Arial Bold:16>Thermal Erosion<font:Arial:16> - erodes an existing operation using a thermal erosion algorithm
|
||||
<font:Arial Bold:16>Hydraulic Erosion<font:Arial:16> - erodes an existing operation using a hydraulic erosion algorithm
|
||||
<font:Arial Bold:16>Blend<font:Arial:16> - blends two existing operations acording to a scale factor and mathmatical operator
|
||||
<font:Arial Bold:16>Terrain File<font:Arial:16> - loads an existing terrain file onto the stack
|
12
example/common/help/9. Terrain Texture Editor.hfl
Executable file
@ -0,0 +1,12 @@
|
||||
<lmargin%:5><rmargin%:95><font:Arial Bold:20>Terrain Texture Editor...<font:Arial:16>
|
||||
|
||||
The Terrain Texture Editor is used to algorithmically place terrain texures based on the heightfield at the bottom of the terraformer heightfield stack. The texture editor has three main interface elements on the right side of the screen - from top to bottom they are the operation inspector pane, the material list, and the placement operation list.
|
||||
|
||||
Essentially, terrain materials (textures) are added with the "Add Material" button. This will look for any texture (.png or .jpg) in a subdirectory of any directory named "terrains". Once a material is added to the terrain, the user can select one of several placement operations that govern where that material will be placed on the terrain - they are:
|
||||
|
||||
<font:Arial Bold:16>Place by Fractal<font:Arial:16> - Places the terrain texture randomly across the terrain based on a brownian motion fractal.
|
||||
<font:Arial Bold:16>Place by Height<font:Arial:16> - Places the texture based on an elevation filter
|
||||
<font:Arial Bold:16>Place by Slope<font:Arial:16> - Places the texture based on a slope filter
|
||||
<font:Arial Bold:16>Place by Water Level<font:Arial:16> - Places the texture based on the water level parameter in the terraform editor
|
||||
|
||||
Pressing the "Apply" button applies the current texture operation list to the terrain file.
|
BIN
example/common/lighting/corona.png
Executable file
After Width: | Height: | Size: 9.3 KiB |
BIN
example/common/lighting/lightFalloffMono.png
Executable file
After Width: | Height: | Size: 67 KiB |
BIN
example/common/lighting/whiteAlpha255.png
Executable file
After Width: | Height: | Size: 165 B |
BIN
example/common/lighting/whiteNoAlpha.png
Executable file
After Width: | Height: | Size: 164 B |
295
example/common/main.cs
Executable file
@ -0,0 +1,295 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Load up defaults console values.
|
||||
|
||||
exec("./defaults.cs");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function initCommon()
|
||||
{
|
||||
// All mods need the random seed set
|
||||
setRandomSeed();
|
||||
|
||||
// Very basic functions used by everyone
|
||||
exec("./client/canvas.cs");
|
||||
exec("./client/audio.cs");
|
||||
}
|
||||
|
||||
function initBaseClient()
|
||||
{
|
||||
// Base client functionality
|
||||
exec("./client/message.cs");
|
||||
exec("./client/mission.cs");
|
||||
exec("./client/missionDownload.cs");
|
||||
exec("./client/actionMap.cs");
|
||||
|
||||
// There are also a number of support scripts loaded by the canvas
|
||||
// when it's first initialized. Check out client/canvas.cs
|
||||
}
|
||||
|
||||
function initBaseServer()
|
||||
{
|
||||
// Base server functionality
|
||||
exec("./server/audio.cs");
|
||||
exec("./server/server.cs");
|
||||
exec("./server/message.cs");
|
||||
exec("./server/commands.cs");
|
||||
exec("./server/missionInfo.cs");
|
||||
exec("./server/missionLoad.cs");
|
||||
exec("./server/missionDownload.cs");
|
||||
exec("./server/clientConnection.cs");
|
||||
exec("./server/kickban.cs");
|
||||
exec("./server/game.cs");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
package Common {
|
||||
|
||||
function displayHelp() {
|
||||
Parent::displayHelp();
|
||||
error(
|
||||
"Common Mod options:\n"@
|
||||
" -fullscreen Starts game in full screen mode\n"@
|
||||
" -windowed Starts game in windowed mode\n"@
|
||||
" -autoVideo Auto detect video, but prefers OpenGL\n"@
|
||||
" -openGL Force OpenGL acceleration\n"@
|
||||
" -directX Force DirectX acceleration\n"@
|
||||
" -voodoo2 Force Voodoo2 acceleration\n"@
|
||||
" -noSound Starts game without sound\n"@
|
||||
" -prefs <configFile> Exec the config file\n"
|
||||
);
|
||||
}
|
||||
|
||||
function parseArgs()
|
||||
{
|
||||
Parent::parseArgs();
|
||||
|
||||
// Arguments override defaults...
|
||||
for (%i = 1; %i < $Game::argc ; %i++)
|
||||
{
|
||||
%arg = $Game::argv[%i];
|
||||
%nextArg = $Game::argv[%i+1];
|
||||
%hasNextArg = $Game::argc - %i > 1;
|
||||
|
||||
switch$ (%arg)
|
||||
{
|
||||
//--------------------
|
||||
case "-fullscreen":
|
||||
$pref::Video::fullScreen = 1;
|
||||
$argUsed[%i]++;
|
||||
|
||||
//--------------------
|
||||
case "-windowed":
|
||||
$pref::Video::fullScreen = 0;
|
||||
$argUsed[%i]++;
|
||||
|
||||
//--------------------
|
||||
case "-noSound":
|
||||
error("no support yet");
|
||||
$argUsed[%i]++;
|
||||
|
||||
//--------------------
|
||||
case "-openGL":
|
||||
$pref::Video::displayDevice = "OpenGL";
|
||||
$argUsed[%i]++;
|
||||
|
||||
//--------------------
|
||||
case "-directX":
|
||||
$pref::Video::displayDevice = "D3D";
|
||||
$argUsed[%i]++;
|
||||
|
||||
//--------------------
|
||||
case "-voodoo2":
|
||||
$pref::Video::displayDevice = "Voodoo2";
|
||||
$argUsed[%i]++;
|
||||
|
||||
//--------------------
|
||||
case "-autoVideo":
|
||||
$pref::Video::displayDevice = "";
|
||||
$argUsed[%i]++;
|
||||
|
||||
//--------------------
|
||||
case "-prefs":
|
||||
$argUsed[%i]++;
|
||||
if (%hasNextArg) {
|
||||
exec(%nextArg, true, true);
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -prefs <path/script.cs>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onStart()
|
||||
{
|
||||
Parent::onStart();
|
||||
echo("\n--------- Initializing MOD: Common ---------");
|
||||
initCommon();
|
||||
}
|
||||
|
||||
function onExit()
|
||||
{
|
||||
echo("Exporting client prefs");
|
||||
export("$pref::*", "./client/prefs.cs", False);
|
||||
|
||||
echo("Exporting server prefs");
|
||||
export("$Pref::Server::*", "./server/prefs.cs", False);
|
||||
BanList::Export("./server/banlist.cs");
|
||||
|
||||
OpenALShutdown();
|
||||
Parent::onExit();
|
||||
}
|
||||
|
||||
}; // Common package
|
||||
activatePackage(Common);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function generateRandomChunkery(%parent)
|
||||
{
|
||||
$chunkTestLevel--;
|
||||
%count = getRandom(100);
|
||||
|
||||
for(%i=0; %i<%count; %i++)
|
||||
{
|
||||
$chunkCreateCount++;
|
||||
|
||||
|
||||
%obj = new TextChunk()
|
||||
{
|
||||
textData = "level= " @ $chunkTestLevel @ ", idx = " @ %i @ $buff;
|
||||
};
|
||||
|
||||
if($chunkTestLevel > 0)
|
||||
generateRandomChunkery(%obj);
|
||||
|
||||
%parent.add(%obj);
|
||||
|
||||
// If we're hitting our limit, stop making stuff.
|
||||
if($chunkCreateCount > $chunkMaxCount)
|
||||
break;
|
||||
}
|
||||
|
||||
$chunkTestLevel++;
|
||||
}
|
||||
|
||||
function generateBigChunkTest(%buffSize, %chunkCount)
|
||||
{
|
||||
$chunkStartTime = getRealTime();
|
||||
|
||||
$chunkTestLevel = 10;
|
||||
$chunkCreateCount = 0;
|
||||
$chunkMaxCount = %chunkcount; // At most 16 megs of data.
|
||||
|
||||
$a = getRealTime();
|
||||
$buff = "";
|
||||
while(strlen($buff) < %buffSize)
|
||||
$buff = $buff @ "klmadskldasjkadlkjsakjlsdjksldakjlkjdlaakjlsdkljaslkjslkjdaslkjd";
|
||||
$b = getRealTime();
|
||||
|
||||
$root = new TextChunk() { textData = "ROOT"; };
|
||||
|
||||
$c = getRealTime();
|
||||
generateRandomChunkery($root);
|
||||
$d = getRealTime();
|
||||
|
||||
echo("Created " @ $chunkCreateCount @ " chunks in " @ $chunkTestLevel @ " levels.");
|
||||
|
||||
%file = "common/bigchunktest.chunk";
|
||||
echo("Saving to '" @ %file @ "'...");
|
||||
$e = getRealTime();
|
||||
saveChunkFile($root, %file);
|
||||
$f = getRealTime();
|
||||
echo("Done.");
|
||||
|
||||
echo("Deleting object hierarchy...");
|
||||
$root.delete();
|
||||
echo("Done.");
|
||||
|
||||
echo("Loading object hierarchy from '"@%file@"'...");
|
||||
$g = getRealTime();
|
||||
$newRoot = loadChunkFile(%file);
|
||||
$h = getRealTime();
|
||||
echo("Done.");
|
||||
|
||||
echo("chunkCount = " @ $chunkCreateCount @ ", chunkSize=" @ %buffSize);
|
||||
echo("Generated data = " @ ($chunkCreateCount * %buffSize));
|
||||
echo("Elapsed time = " @ ((getRealTime() - $chunkStartTime)/1000) @ " sec.");
|
||||
echo("Buffer init = " @ (($b-$a)/1000) @ " sec.");
|
||||
echo("chunk gen = " @ (($d-$c)/1000) @ " sec.");
|
||||
echo("save time = " @ (($f-$e)/1000) @ " sec.");
|
||||
echo("load time = " @ (($h-$g)/1000) @ " sec.");
|
||||
|
||||
return $newRoot;
|
||||
}
|
||||
|
||||
function testchunk()
|
||||
{
|
||||
%foo =
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "pony";
|
||||
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "child1";
|
||||
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "childQ";
|
||||
};
|
||||
};
|
||||
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "child2";
|
||||
};
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "child3";
|
||||
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "childA";
|
||||
};
|
||||
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "childB";
|
||||
};
|
||||
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "childC";
|
||||
};
|
||||
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "childD";
|
||||
};
|
||||
|
||||
new TextChunk()
|
||||
{
|
||||
textData = "childE";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
saveChunkFile(%foo, "starter.fps/test.chunk");
|
||||
|
||||
%foo.delete();
|
||||
|
||||
$foo = loadChunkFile("starter.fps/test.chunk");
|
||||
|
||||
|
||||
}
|
23
example/common/server/audio.cs
Executable file
@ -0,0 +1,23 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function ServerPlay2D(%profile)
|
||||
{
|
||||
// Play the given sound profile on every client.
|
||||
// The sounds will be transmitted as an event, not attached to any object.
|
||||
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
|
||||
ClientGroup.getObject(%idx).play2D(%profile);
|
||||
}
|
||||
|
||||
function ServerPlay3D(%profile,%transform)
|
||||
{
|
||||
// Play the given sound profile at the given position on every client
|
||||
// The sound will be transmitted as an event, not attached to any object.
|
||||
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
|
||||
ClientGroup.getObject(%idx).play3D(%profile,%transform);
|
||||
}
|
||||
|
0
example/common/server/banlist.cs
Executable file
205
example/common/server/clientConnection.cs
Executable file
@ -0,0 +1,205 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// This script function is called before a client connection
|
||||
// is accepted. Returning "" will accept the connection,
|
||||
// anything else will be sent back as an error to the client.
|
||||
// All the connect args are passed also to onConnectRequest
|
||||
//
|
||||
function GameConnection::onConnectRequest( %client, %netAddress, %name )
|
||||
{
|
||||
echo("Connect request from: " @ %netAddress);
|
||||
if($Server::PlayerCount >= $pref::Server::MaxPlayers)
|
||||
return "CR_SERVERFULL";
|
||||
return "";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// This script function is the first called on a client accept
|
||||
//
|
||||
function GameConnection::onConnect( %client, %name )
|
||||
{
|
||||
// Send down the connection error info, the client is
|
||||
// responsible for displaying this message if a connection
|
||||
// error occures.
|
||||
messageClient(%client,'MsgConnectionError',"",$Pref::Server::ConnectionError);
|
||||
|
||||
// Send mission information to the client
|
||||
sendLoadInfoToClient( %client );
|
||||
|
||||
// Simulated client lag for testing...
|
||||
// %client.setSimulatedNetParams(0.1, 30);
|
||||
|
||||
// Get the client's unique id:
|
||||
// %authInfo = %client.getAuthInfo();
|
||||
// %client.guid = getField( %authInfo, 3 );
|
||||
%client.guid = 0;
|
||||
addToServerGuidList( %client.guid );
|
||||
|
||||
// Set admin status
|
||||
if (%client.getAddress() $= "local") {
|
||||
%client.isAdmin = true;
|
||||
%client.isSuperAdmin = true;
|
||||
}
|
||||
else {
|
||||
%client.isAdmin = false;
|
||||
%client.isSuperAdmin = false;
|
||||
}
|
||||
|
||||
// Save client preferences on the connection object for later use.
|
||||
%client.gender = "Male";
|
||||
%client.armor = "Light";
|
||||
%client.race = "Human";
|
||||
%client.skin = addTaggedString( "base" );
|
||||
%client.setPlayerName(%name);
|
||||
%client.score = 0;
|
||||
|
||||
//
|
||||
$instantGroup = ServerGroup;
|
||||
$instantGroup = MissionCleanup;
|
||||
echo("CADD: " @ %client @ " " @ %client.getAddress());
|
||||
|
||||
// Inform the client of all the other clients
|
||||
%count = ClientGroup.getCount();
|
||||
for (%cl = 0; %cl < %count; %cl++) {
|
||||
%other = ClientGroup.getObject(%cl);
|
||||
if ((%other != %client)) {
|
||||
// These should be "silent" versions of these messages...
|
||||
messageClient(%client, 'MsgClientJoin', "",
|
||||
%other.name,
|
||||
%other,
|
||||
%other.sendGuid,
|
||||
%other.score,
|
||||
%other.isAIControlled(),
|
||||
%other.isAdmin,
|
||||
%other.isSuperAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
// Inform the client we've joined up
|
||||
messageClient(%client,
|
||||
'MsgClientJoin', '\c2Welcome to the Torque demo app %1.',
|
||||
%client.name,
|
||||
%client,
|
||||
%client.sendGuid,
|
||||
%client.score,
|
||||
%client.isAiControlled(),
|
||||
%client.isAdmin,
|
||||
%client.isSuperAdmin);
|
||||
|
||||
// Inform all the other clients of the new guy
|
||||
messageAllExcept(%client, -1, 'MsgClientJoin', '\c1%1 joined the game.',
|
||||
%client.name,
|
||||
%client,
|
||||
%client.sendGuid,
|
||||
%client.score,
|
||||
%client.isAiControlled(),
|
||||
%client.isAdmin,
|
||||
%client.isSuperAdmin);
|
||||
|
||||
// If the mission is running, go ahead download it to the client
|
||||
if ($missionRunning)
|
||||
%client.loadMission();
|
||||
$Server::PlayerCount++;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A player's name could be obtained from the auth server, but for
|
||||
// now we use the one passed from the client.
|
||||
// %realName = getField( %authInfo, 0 );
|
||||
//
|
||||
function GameConnection::setPlayerName(%client,%name)
|
||||
{
|
||||
%client.sendGuid = 0;
|
||||
|
||||
// Minimum length requirements
|
||||
%name = stripTrailingSpaces( strToPlayerName( %name ) );
|
||||
if ( strlen( %name ) < 3 )
|
||||
%name = "Poser";
|
||||
|
||||
// Make sure the alias is unique, we'll hit something eventually
|
||||
if (!isNameUnique(%name))
|
||||
{
|
||||
%isUnique = false;
|
||||
for (%suffix = 1; !%isUnique; %suffix++) {
|
||||
%nameTry = %name @ "." @ %suffix;
|
||||
%isUnique = isNameUnique(%nameTry);
|
||||
}
|
||||
%name = %nameTry;
|
||||
}
|
||||
|
||||
// Tag the name with the "smurf" color:
|
||||
%client.nameBase = %name;
|
||||
%client.name = addTaggedString("\cp\c8" @ %name @ "\co");
|
||||
}
|
||||
|
||||
function isNameUnique(%name)
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
%test = ClientGroup.getObject( %i );
|
||||
%rawName = stripChars( detag( getTaggedString( %test.name ) ), "\cp\co\c6\c7\c8\c9" );
|
||||
if ( strcmp( %name, %rawName ) == 0 )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// This function is called when a client drops for any reason
|
||||
//
|
||||
function GameConnection::onDrop(%client, %reason)
|
||||
{
|
||||
%client.onClientLeaveGame();
|
||||
|
||||
removeFromServerGuidList( %client.guid );
|
||||
messageAllExcept(%client, -1, 'MsgClientDrop', '\c1%1 has left the game.', %client.name, %client);
|
||||
|
||||
removeTaggedString(%client.name);
|
||||
echo("CDROP: " @ %client @ " " @ %client.getAddress());
|
||||
$Server::PlayerCount--;
|
||||
|
||||
// Reset the server if everyone has left the game
|
||||
if( $Server::PlayerCount == 0 && $Server::Dedicated)
|
||||
schedule(0, 0, "resetServerDefaults");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function GameConnection::startMission(%this)
|
||||
{
|
||||
// Inform the client the mission starting
|
||||
commandToClient(%this, 'MissionStart', $missionSequence);
|
||||
}
|
||||
|
||||
|
||||
function GameConnection::endMission(%this)
|
||||
{
|
||||
// Inform the client the mission is done
|
||||
commandToClient(%this, 'MissionEnd', $missionSequence);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Sync the clock on the client.
|
||||
|
||||
function GameConnection::syncClock(%client, %time)
|
||||
{
|
||||
commandToClient(%client, 'syncClock', %time);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Update all the clients with the new score
|
||||
|
||||
function GameConnection::incScore(%this,%delta)
|
||||
{
|
||||
%this.score += %delta;
|
||||
messageAll('MsgClientScoreChanged', "", %this.score, %this);
|
||||
}
|
46
example/common/server/commands.cs
Executable file
@ -0,0 +1,46 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Misc. server commands avialable to clients
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function serverCmdSAD( %client, %password )
|
||||
{
|
||||
if( %password !$= "" && %password $= $Pref::Server::AdminPassword)
|
||||
{
|
||||
%client.isAdmin = true;
|
||||
%client.isSuperAdmin = true;
|
||||
%name = getTaggedString( %client.name );
|
||||
MessageAll( 'MsgAdminForce', "\c2" @ %name @ " has become Admin by force.", %client );
|
||||
}
|
||||
}
|
||||
|
||||
function serverCmdSADSetPassword(%client, %password)
|
||||
{
|
||||
if(%client.isSuperAdmin)
|
||||
$Pref::Server::AdminPassword = %password;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Server chat message handlers
|
||||
|
||||
function serverCmdTeamMessageSent(%client, %text)
|
||||
{
|
||||
if(strlen(%text) >= $Pref::Server::MaxChatLen)
|
||||
%text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
|
||||
chatMessageTeam(%client, %client.team, '\c3%1: %2', %client.name, %text);
|
||||
}
|
||||
|
||||
function serverCmdMessageSent(%client, %text)
|
||||
{
|
||||
if(strlen(%text) >= $Pref::Server::MaxChatLen)
|
||||
%text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
|
||||
chatMessageAll(%client, '\c4%1: %2', %client.name, %text);
|
||||
}
|
||||
|
106
example/common/server/game.cs
Executable file
@ -0,0 +1,106 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Invoked from the common server & mission loading functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function onServerCreated()
|
||||
{
|
||||
// Invoked by createServer(), when server is created and ready to go
|
||||
|
||||
// Server::GameType is sent to the master server.
|
||||
// This variable should uniquely identify your game and/or mod.
|
||||
$Server::GameType = "Test App";
|
||||
|
||||
// Server::MissionType sent to the master server. Clients can
|
||||
// filter servers based on mission type.
|
||||
$Server::MissionType = "Deathmatch";
|
||||
|
||||
// Load up all datablocks, objects etc. This function is called when
|
||||
// a server is constructed.
|
||||
// exec("./foo.cs");
|
||||
|
||||
// For backwards compatibility...
|
||||
createGame();
|
||||
}
|
||||
|
||||
function onServerDestroyed()
|
||||
{
|
||||
// Invoked by destroyServer(), right before the server is destroyed
|
||||
destroyGame();
|
||||
}
|
||||
|
||||
function onMissionLoaded()
|
||||
{
|
||||
// Called by loadMission() once the mission is finished loading
|
||||
startGame();
|
||||
}
|
||||
|
||||
function onMissionEnded()
|
||||
{
|
||||
// Called by endMission(), right before the mission is destroyed
|
||||
endGame();
|
||||
}
|
||||
|
||||
function onMissionReset()
|
||||
{
|
||||
// Called by resetMission(), after all the temporary mission objects
|
||||
// have been deleted.
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// These methods are extensions to the GameConnection class. Extending
|
||||
// GameConnection make is easier to deal with some of this functionality,
|
||||
// but these could also be implemented as stand-alone functions.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function GameConnection::onClientEnterGame(%this)
|
||||
{
|
||||
// Called for each client after it's finished downloading the
|
||||
// mission and is ready to start playing.
|
||||
// Tg: Should think about renaming this onClientEnterMission
|
||||
}
|
||||
|
||||
function GameConnection::onClientLeaveGame(%this)
|
||||
{
|
||||
// Call for each client that drops
|
||||
// Tg: Should think about renaming this onClientLeaveMission
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions that implement game-play
|
||||
// These are here for backwards compatibilty only, games and/or mods should
|
||||
// really be overloading the server and mission functions listed ubove.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function createGame()
|
||||
{
|
||||
// This function is called by onServerCreated (ubove)
|
||||
}
|
||||
|
||||
function destroyGame()
|
||||
{
|
||||
// This function is called by onServerDestroyed (ubove)
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function startGame()
|
||||
{
|
||||
// This is where the game play should start
|
||||
// The default onMissionLoaded function starts the game.
|
||||
}
|
||||
|
||||
function endGame()
|
||||
{
|
||||
// This is where the game play should end
|
||||
// The default onMissionEnded function shuts down the game.
|
||||
}
|
24
example/common/server/kickban.cs
Executable file
@ -0,0 +1,24 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function kick(%client)
|
||||
{
|
||||
messageAll( 'MsgAdminForce', '\c2The Admin has kicked %1.', %client.name);
|
||||
|
||||
if (!%client.isAIControlled())
|
||||
BanList::add(%client.guid, %client.getAddress(), $Pref::Server::KickBanTime);
|
||||
%client.delete("You have been kicked from this server");
|
||||
}
|
||||
|
||||
function ban(%client)
|
||||
{
|
||||
messageAll('MsgAdminForce', '\c2The Admin has banned %1.', %client.name);
|
||||
|
||||
if (!%client.isAIControlled())
|
||||
BanList::add(%client.guid, %client.getAddress(), $Pref::Server::BanTime);
|
||||
%client.delete("You have been banned from this server");
|
||||
}
|
154
example/common/server/message.cs
Executable file
@ -0,0 +1,154 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Server side message commands
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
commandToClient(%client, 'ServerMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
|
||||
function messageTeam(%team, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for(%cl= 0; %cl < %count; %cl++)
|
||||
{
|
||||
%recipient = ClientGroup.getObject(%cl);
|
||||
if(%recipient.team == %team)
|
||||
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
}
|
||||
|
||||
function messageTeamExcept(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
%team = %client.team;
|
||||
%count = ClientGroup.getCount();
|
||||
for(%cl= 0; %cl < %count; %cl++)
|
||||
{
|
||||
%recipient = ClientGroup.getObject(%cl);
|
||||
if((%recipient.team == %team) && (%recipient != %client))
|
||||
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
}
|
||||
|
||||
function messageAll(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for(%cl = 0; %cl < %count; %cl++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%cl);
|
||||
messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
}
|
||||
|
||||
function messageAllExcept(%client, %team, %msgtype, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
//can exclude a client, a team or both. A -1 value in either field will ignore that exclusion, so
|
||||
//messageAllExcept(-1, -1, $Mesblah, 'Blah!'); will message everyone (since there shouldn't be a client -1 or client on team -1).
|
||||
%count = ClientGroup.getCount();
|
||||
for(%cl= 0; %cl < %count; %cl++)
|
||||
{
|
||||
%recipient = ClientGroup.getObject(%cl);
|
||||
if((%recipient != %client) && (%recipient.team != %team))
|
||||
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Server side client chat'n
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// silly spam protection...
|
||||
$SPAM_PROTECTION_PERIOD = 10000;
|
||||
$SPAM_MESSAGE_THRESHOLD = 4;
|
||||
$SPAM_PENALTY_PERIOD = 10000;
|
||||
$SPAM_MESSAGE = '\c3FLOOD PROTECTION:\cr You must wait another %1 seconds.';
|
||||
|
||||
function GameConnection::spamMessageTimeout(%this)
|
||||
{
|
||||
if(%this.spamMessageCount > 0)
|
||||
%this.spamMessageCount--;
|
||||
}
|
||||
|
||||
function GameConnection::spamReset(%this)
|
||||
{
|
||||
%this.isSpamming = false;
|
||||
}
|
||||
|
||||
function spamAlert(%client)
|
||||
{
|
||||
if($Pref::Server::FloodProtectionEnabled != true)
|
||||
return(false);
|
||||
|
||||
if(!%client.isSpamming && (%client.spamMessageCount >= $SPAM_MESSAGE_THRESHOLD))
|
||||
{
|
||||
%client.spamProtectStart = getSimTime();
|
||||
%client.isSpamming = true;
|
||||
%client.schedule($SPAM_PENALTY_PERIOD, spamReset);
|
||||
}
|
||||
|
||||
if(%client.isSpamming)
|
||||
{
|
||||
%wait = mFloor(($SPAM_PENALTY_PERIOD - (getSimTime() - %client.spamProtectStart)) / 1000);
|
||||
messageClient(%client, "", $SPAM_MESSAGE, %wait);
|
||||
return(true);
|
||||
}
|
||||
|
||||
%client.spamMessageCount++;
|
||||
%client.schedule($SPAM_PROTECTION_PERIOD, spamMessageTimeout);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function chatMessageClient( %client, %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
|
||||
{
|
||||
//see if the client has muted the sender
|
||||
if ( !%client.muted[%sender] )
|
||||
commandToClient( %client, 'ChatMessage', %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
}
|
||||
|
||||
function chatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
|
||||
{
|
||||
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
|
||||
return;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
%obj = ClientGroup.getObject( %i );
|
||||
if ( %obj.team == %sender.team )
|
||||
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
}
|
||||
}
|
||||
|
||||
function chatMessageAll( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
|
||||
{
|
||||
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
|
||||
return;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
%obj = ClientGroup.getObject( %i );
|
||||
|
||||
if(%sender.team != 0)
|
||||
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
else
|
||||
{
|
||||
// message sender is an observer -- only send message to other observers
|
||||
if(%obj.team == %sender.team)
|
||||
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
117
example/common/server/missionDownload.cs
Executable file
@ -0,0 +1,117 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Mission Loading
|
||||
// The server portion of the client/server mission loading process
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Loading Phases:
|
||||
// Phase 1: Transmit Datablocks
|
||||
// Transmit targets
|
||||
// Phase 2: Transmit Ghost Objects
|
||||
// Phase 3: Start Game
|
||||
//
|
||||
// The server invokes the client MissionStartPhase[1-3] function to request
|
||||
// permission to start each phase. When a client is ready for a phase,
|
||||
// it responds with MissionStartPhase[1-3]Ack.
|
||||
|
||||
function GameConnection::loadMission(%this)
|
||||
{
|
||||
// Send over the information that will display the server info
|
||||
// when we learn it got there, we'll send the data blocks
|
||||
%this.currentPhase = 0;
|
||||
if (%this.isAIControlled())
|
||||
{
|
||||
// Cut to the chase...
|
||||
%this.onClientEnterGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
commandToClient(%this, 'MissionStartPhase1', $missionSequence,
|
||||
$Server::MissionFile, MissionGroup.musicTrack);
|
||||
echo("*** Sending mission load to client: " @ $Server::MissionFile);
|
||||
}
|
||||
}
|
||||
|
||||
function serverCmdMissionStartPhase1Ack(%client, %seq)
|
||||
{
|
||||
// Make sure to ignore calls from a previous mission load
|
||||
if (%seq != $missionSequence || !$MissionRunning)
|
||||
return;
|
||||
if (%client.currentPhase != 0)
|
||||
return;
|
||||
%client.currentPhase = 1;
|
||||
|
||||
// Start with the CRC
|
||||
%client.setMissionCRC( $missionCRC );
|
||||
|
||||
// Send over the datablocks...
|
||||
// OnDataBlocksDone will get called when have confirmation
|
||||
// that they've all been received.
|
||||
%client.transmitDataBlocks($missionSequence);
|
||||
}
|
||||
|
||||
function GameConnection::onDataBlocksDone( %this, %missionSequence )
|
||||
{
|
||||
// Make sure to ignore calls from a previous mission load
|
||||
if (%missionSequence != $missionSequence)
|
||||
return;
|
||||
if (%this.currentPhase != 1)
|
||||
return;
|
||||
%this.currentPhase = 1.5;
|
||||
|
||||
// On to the next phase
|
||||
commandToClient(%this, 'MissionStartPhase2', $missionSequence, $Server::MissionFile);
|
||||
}
|
||||
|
||||
function serverCmdMissionStartPhase2Ack(%client, %seq)
|
||||
{
|
||||
// Make sure to ignore calls from a previous mission load
|
||||
if (%seq != $missionSequence || !$MissionRunning)
|
||||
return;
|
||||
if (%client.currentPhase != 1.5)
|
||||
return;
|
||||
%client.currentPhase = 2;
|
||||
|
||||
// Update mod paths, this needs to get there before the objects.
|
||||
%client.transmitPaths();
|
||||
|
||||
// Start ghosting objects to the client
|
||||
%client.activateGhosting();
|
||||
|
||||
}
|
||||
|
||||
function GameConnection::clientWantsGhostAlwaysRetry(%client)
|
||||
{
|
||||
if($MissionRunning)
|
||||
%client.activateGhosting();
|
||||
}
|
||||
|
||||
function GameConnection::onGhostAlwaysFailed(%client)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function GameConnection::onGhostAlwaysObjectsReceived(%client)
|
||||
{
|
||||
// Ready for next phase.
|
||||
commandToClient(%client, 'MissionStartPhase3', $missionSequence, $Server::MissionFile);
|
||||
}
|
||||
|
||||
function serverCmdMissionStartPhase3Ack(%client, %seq)
|
||||
{
|
||||
// Make sure to ignore calls from a previous mission load
|
||||
if(%seq != $missionSequence || !$MissionRunning)
|
||||
return;
|
||||
if(%client.currentPhase != 2)
|
||||
return;
|
||||
%client.currentPhase = 3;
|
||||
|
||||
// Server is ready to drop into the game
|
||||
%client.startMission();
|
||||
%client.onClientEnterGame();
|
||||
}
|
88
example/common/server/missionInfo.cs
Executable file
@ -0,0 +1,88 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Loading info is text displayed on the client side while the mission
|
||||
// is being loaded. This information is extracted from the mission file
|
||||
// and sent to each the client as it joins.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// clearLoadInfo
|
||||
//
|
||||
// Clears the mission info stored
|
||||
//------------------------------------------------------------------------------
|
||||
function clearLoadInfo() {
|
||||
if (isObject(MissionInfo))
|
||||
MissionInfo.delete();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// buildLoadInfo
|
||||
//
|
||||
// Extract the map description from the .mis file
|
||||
//------------------------------------------------------------------------------
|
||||
function buildLoadInfo( %mission ) {
|
||||
clearLoadInfo();
|
||||
|
||||
%infoObject = "";
|
||||
%file = new FileObject();
|
||||
|
||||
if ( %file.openForRead( %mission ) ) {
|
||||
%inInfoBlock = false;
|
||||
|
||||
while ( !%file.isEOF() ) {
|
||||
%line = %file.readLine();
|
||||
%line = trim( %line );
|
||||
|
||||
if( %line $= "new ScriptObject(MissionInfo) {" )
|
||||
%inInfoBlock = true;
|
||||
else if( %inInfoBlock && %line $= "};" ) {
|
||||
%inInfoBlock = false;
|
||||
%infoObject = %infoObject @ %line;
|
||||
break;
|
||||
}
|
||||
|
||||
if( %inInfoBlock )
|
||||
%infoObject = %infoObject @ %line @ " ";
|
||||
}
|
||||
|
||||
%file.close();
|
||||
}
|
||||
|
||||
// Will create the object "MissionInfo"
|
||||
eval( %infoObject );
|
||||
%file.delete();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// dumpLoadInfo
|
||||
//
|
||||
// Echo the mission information to the console
|
||||
//------------------------------------------------------------------------------
|
||||
function dumpLoadInfo()
|
||||
{
|
||||
echo( "Mission Name: " @ MissionInfo.name );
|
||||
echo( "Mission Description:" );
|
||||
|
||||
for( %i = 0; MissionInfo.desc[%i] !$= ""; %i++ )
|
||||
echo (" " @ MissionInfo.desc[%i]);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// sendLoadInfoToClient
|
||||
//
|
||||
// Sends mission description to the client
|
||||
//------------------------------------------------------------------------------
|
||||
function sendLoadInfoToClient( %client )
|
||||
{
|
||||
messageClient( %client, 'MsgLoadInfo', "", MissionInfo.name );
|
||||
|
||||
// Send Mission Description a line at a time
|
||||
for( %i = 0; MissionInfo.desc[%i] !$= ""; %i++ )
|
||||
messageClient( %client, 'MsgLoadDescripition', "", MissionInfo.desc[%i] );
|
||||
|
||||
messageClient( %client, 'MsgLoadInfoDone' );
|
||||
}
|
147
example/common/server/missionLoad.cs
Executable file
@ -0,0 +1,147 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Server mission loading
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// On every mission load except the first, there is a pause after
|
||||
// the initial mission info is downloaded to the client.
|
||||
$MissionLoadPause = 5000;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function loadMission( %missionName, %isFirstMission )
|
||||
{
|
||||
endMission();
|
||||
echo("*** LOADING MISSION: " @ %missionName);
|
||||
echo("*** Stage 1 load");
|
||||
|
||||
// Reset all of these
|
||||
clearCenterPrintAll();
|
||||
clearBottomPrintAll();
|
||||
|
||||
// increment the mission sequence (used for ghost sequencing)
|
||||
$missionSequence++;
|
||||
$missionRunning = false;
|
||||
$Server::MissionFile = %missionName;
|
||||
|
||||
// Extract mission info from the mission file,
|
||||
// including the display name and stuff to send
|
||||
// to the client.
|
||||
buildLoadInfo( %missionName );
|
||||
|
||||
// Download mission info to the clients
|
||||
%count = ClientGroup.getCount();
|
||||
for( %cl = 0; %cl < %count; %cl++ ) {
|
||||
%client = ClientGroup.getObject( %cl );
|
||||
if (!%client.isAIControlled())
|
||||
sendLoadInfoToClient(%client);
|
||||
}
|
||||
|
||||
// if this isn't the first mission, allow some time for the server
|
||||
// to transmit information to the clients:
|
||||
if( %isFirstMission || $Server::ServerType $= "SinglePlayer" )
|
||||
loadMissionStage2();
|
||||
else
|
||||
schedule( $MissionLoadPause, ServerGroup, loadMissionStage2 );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function loadMissionStage2()
|
||||
{
|
||||
// Create the mission group off the ServerGroup
|
||||
echo("*** Stage 2 load");
|
||||
$instantGroup = ServerGroup;
|
||||
|
||||
// Make sure the mission exists
|
||||
%file = $Server::MissionFile;
|
||||
|
||||
if( !isFile( %file ) ) {
|
||||
error( "Could not find mission " @ %file );
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate the mission CRC. The CRC is used by the clients
|
||||
// to caching mission lighting.
|
||||
$missionCRC = getFileCRC( %file );
|
||||
|
||||
// Exec the mission, objects are added to the ServerGroup
|
||||
exec(%file);
|
||||
|
||||
// If there was a problem with the load, let's try another mission
|
||||
if( !isObject(MissionGroup) ) {
|
||||
error( "No 'MissionGroup' found in mission \"" @ $missionName @ "\"." );
|
||||
schedule( 3000, ServerGroup, CycleMissions );
|
||||
return;
|
||||
}
|
||||
|
||||
// Mission cleanup group
|
||||
new SimGroup( MissionCleanup );
|
||||
$instantGroup = MissionCleanup;
|
||||
|
||||
// Construct MOD paths
|
||||
pathOnMissionLoadDone();
|
||||
|
||||
// Mission loading done...
|
||||
echo("*** Mission loaded");
|
||||
|
||||
// Start all the clients in the mission
|
||||
$missionRunning = true;
|
||||
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
|
||||
ClientGroup.getObject(%clientIndex).loadMission();
|
||||
|
||||
// Go ahead and launch the game
|
||||
onMissionLoaded();
|
||||
purgeResources();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function endMission()
|
||||
{
|
||||
if (!isObject( MissionGroup ))
|
||||
return;
|
||||
|
||||
echo("*** ENDING MISSION");
|
||||
|
||||
// Inform the game code we're done.
|
||||
onMissionEnded();
|
||||
|
||||
// Inform the clients
|
||||
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
|
||||
// clear ghosts and paths from all clients
|
||||
%cl = ClientGroup.getObject( %clientIndex );
|
||||
%cl.endMission();
|
||||
%cl.resetGhosting();
|
||||
%cl.clearPaths();
|
||||
}
|
||||
|
||||
// Delete everything
|
||||
MissionGroup.delete();
|
||||
MissionCleanup.delete();
|
||||
|
||||
$ServerGroup.delete();
|
||||
$ServerGroup = new SimGroup(ServerGroup);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function resetMission()
|
||||
{
|
||||
echo("*** MISSION RESET");
|
||||
|
||||
// Remove any temporary mission objects
|
||||
MissionCleanup.delete();
|
||||
$instantGroup = ServerGroup;
|
||||
new SimGroup( MissionCleanup );
|
||||
$instantGroup = MissionCleanup;
|
||||
|
||||
//
|
||||
onMissionReset();
|
||||
}
|
148
example/common/server/server.cs
Executable file
@ -0,0 +1,148 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function portInit(%port)
|
||||
{
|
||||
%failCount = 0;
|
||||
while(%failCount < 10 && !setNetPort(%port)) {
|
||||
echo("Port init failed on port " @ %port @ " trying next port.");
|
||||
%port++; %failCount++;
|
||||
}
|
||||
}
|
||||
|
||||
function createServer(%serverType, %mission)
|
||||
{
|
||||
if (%mission $= "") {
|
||||
error("createServer: mission name unspecified");
|
||||
return;
|
||||
}
|
||||
|
||||
destroyServer();
|
||||
|
||||
//
|
||||
$missionSequence = 0;
|
||||
$Server::PlayerCount = 0;
|
||||
$Server::ServerType = %serverType;
|
||||
|
||||
// Setup for multi-player, the network must have been
|
||||
// initialized before now.
|
||||
if (%serverType $= "MultiPlayer") {
|
||||
echo("Starting multiplayer mode");
|
||||
|
||||
// Make sure the network port is set to the correct pref.
|
||||
portInit($Pref::Server::Port);
|
||||
allowConnections(true);
|
||||
|
||||
if ($pref::Net::DisplayOnMaster !$= "Never" )
|
||||
schedule(0,0,startHeartbeat);
|
||||
}
|
||||
|
||||
// Load the mission
|
||||
$ServerGroup = new SimGroup(ServerGroup);
|
||||
onServerCreated();
|
||||
loadMission(%mission, true);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function destroyServer()
|
||||
{
|
||||
$Server::ServerType = "";
|
||||
allowConnections(false);
|
||||
stopHeartbeat();
|
||||
$missionRunning = false;
|
||||
|
||||
// End any running mission
|
||||
endMission();
|
||||
onServerDestroyed();
|
||||
|
||||
// Delete all the server objects
|
||||
if (isObject(MissionGroup))
|
||||
MissionGroup.delete();
|
||||
if (isObject(MissionCleanup))
|
||||
MissionCleanup.delete();
|
||||
if (isObject($ServerGroup))
|
||||
$ServerGroup.delete();
|
||||
|
||||
// Delete all the connections:
|
||||
while (ClientGroup.getCount())
|
||||
{
|
||||
%client = ClientGroup.getObject(0);
|
||||
%client.delete();
|
||||
}
|
||||
|
||||
$Server::GuidList = "";
|
||||
|
||||
// Delete all the data blocks...
|
||||
deleteDataBlocks();
|
||||
|
||||
// Save any server settings
|
||||
echo( "Exporting server prefs..." );
|
||||
export( "$Pref::Server::*", "~/prefs.cs", false );
|
||||
|
||||
// Dump anything we're not using
|
||||
purgeResources();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function resetServerDefaults()
|
||||
{
|
||||
echo( "Resetting server defaults..." );
|
||||
|
||||
// Override server defaults with prefs:
|
||||
exec( "~/defaults.cs" );
|
||||
exec( "~/prefs.cs" );
|
||||
|
||||
loadMission( $Server::MissionFile );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Guid list maintenance functions:
|
||||
function addToServerGuidList( %guid )
|
||||
{
|
||||
%count = getFieldCount( $Server::GuidList );
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
if ( getField( $Server::GuidList, %i ) == %guid )
|
||||
return;
|
||||
}
|
||||
|
||||
$Server::GuidList = $Server::GuidList $= "" ? %guid : $Server::GuidList TAB %guid;
|
||||
}
|
||||
|
||||
function removeFromServerGuidList( %guid )
|
||||
{
|
||||
%count = getFieldCount( $Server::GuidList );
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
if ( getField( $Server::GuidList, %i ) == %guid )
|
||||
{
|
||||
$Server::GuidList = removeField( $Server::GuidList, %i );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Huh, didn't find it.
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function onServerInfoQuery()
|
||||
{
|
||||
// When the server is queried for information, the value
|
||||
// of this function is returned as the status field of
|
||||
// the query packet. This information is accessible as
|
||||
// the ServerInfo::State variable.
|
||||
return "Doing Ok";
|
||||
}
|
||||
|
BIN
example/common/ui/CUR_3darrow.png
Executable file
After Width: | Height: | Size: 615 B |
BIN
example/common/ui/CUR_leftright.png
Executable file
After Width: | Height: | Size: 3.0 KiB |
BIN
example/common/ui/CUR_move.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
example/common/ui/CUR_nesw.png
Executable file
After Width: | Height: | Size: 3.0 KiB |
BIN
example/common/ui/CUR_nwse.png
Executable file
After Width: | Height: | Size: 3.0 KiB |
BIN
example/common/ui/CUR_textedit.png
Executable file
After Width: | Height: | Size: 2.9 KiB |
BIN
example/common/ui/CUR_updown.png
Executable file
After Width: | Height: | Size: 3.1 KiB |
275
example/common/ui/ColorPickerDlg.gui
Executable file
@ -0,0 +1,275 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiColorPickerCtrl(ColorPickerDlg) {
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "800 600";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
baseColor = "1.000000 0.000000 1.000000 1.000000";
|
||||
pickColor = "0.788235 0.713726 0.600000 1.000000";
|
||||
selectorGap = "1";
|
||||
displayMode = "Dropper";
|
||||
actionOnMove = "1";
|
||||
|
||||
new GuiWindowCtrl(GuiPickerDlg) {
|
||||
Profile = "GuiWindowProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "51 39";
|
||||
Extent = "358 294";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
text = "Pick Color";
|
||||
maxLength = "255";
|
||||
resizeWidth = "0";
|
||||
resizeHeight = "0";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
MinSize = "50 50";
|
||||
closeCommand = "endColorDropper();Canvas.popDialog(ColorPickerDlg);";
|
||||
|
||||
new GuiColorPickerCtrl(ColorBlendSelect) {
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "9 42";
|
||||
Extent = "314 190";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
baseColor = "0.600000 1.000000 0.000000 1.000000";
|
||||
selectorGap = "1";
|
||||
displayMode = "BlendColor";
|
||||
actionOnMove = "1";
|
||||
};
|
||||
new GuiSliderCtrl(ColorAlphaSelect) {
|
||||
Profile = "GuiSliderProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "8 238";
|
||||
Extent = "293 21";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
range = "0.000000 1.000000";
|
||||
ticks = "255";
|
||||
value = "1";
|
||||
};
|
||||
new GuiColorPickerCtrl(ColorRangeSelect) {
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "328 42";
|
||||
Extent = "21 188";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
Command = "updatePickerBaseColor();";
|
||||
baseColor = "1.000000 0.000000 1.000000 1.000000";
|
||||
pickColor = "0.600000 1.000000 0.000000 1.000000";
|
||||
selectorGap = "1";
|
||||
displayMode = "VertColor";
|
||||
actionOnMove = "1";
|
||||
};
|
||||
new GuiTextCtrl(Channel_R_Val) {
|
||||
Profile = "GuiTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "14 21";
|
||||
Extent = "22 18";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
text = "R : 1.0";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl(Channel_G_Val) {
|
||||
Profile = "GuiTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "69 21";
|
||||
Extent = "23 18";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
text = "G : 1.0";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl(Channel_B_Val) {
|
||||
Profile = "GuiTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "131 21";
|
||||
Extent = "22 18";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
text = "B : 1.0";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl(Channel_A_Val) {
|
||||
Profile = "GuiTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "198 21";
|
||||
Extent = "23 18";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
text = "A : 1.0";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "GuiButtonProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "304 238";
|
||||
Extent = "47 18";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
Command = "toggleColorPicker();";
|
||||
text = "Drop";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "GuiButtonProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "201 267";
|
||||
Extent = "71 17";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
Command = "DoColorPickerCallback();";
|
||||
text = "Ok";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "GuiButtonProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "279 267";
|
||||
Extent = "71 17";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
Command = "Canvas.popDialog(ColorPickerDlg);";
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
$ColorPickerCallback = ""; // Control that we need to update
|
||||
$ColorCallbackType = 1; // ColorI
|
||||
|
||||
// This function pushes the color picker dialog and returns to a callback the selected value
|
||||
function GetColorI( %currentColor, %callback )
|
||||
{
|
||||
$ColorPickerCallback = %callback;
|
||||
$ColorCallbackType = 1; // ColorI
|
||||
|
||||
// Set the RGBA displays accordingly
|
||||
%red = getWord(%currentColor, 0);
|
||||
%green = getWord(%currentColor, 1);
|
||||
%blue = getWord(%currentColor, 2);
|
||||
%alpha = getWord(%currentColor, 3);
|
||||
|
||||
setColorInfo(%red, %green, %blue, %alpha);
|
||||
|
||||
ColorBlendSelect.pickColor = %red SPC %green SPC %blue SPC "1.0";
|
||||
ColorBlendSelect.updateColor();
|
||||
ColorAlphaSelect.setValue(%alpha);
|
||||
|
||||
Canvas.pushDialog(ColorPickerDlg);
|
||||
}
|
||||
|
||||
function GetColorF( %currentColor, %callback )
|
||||
{
|
||||
$ColorPickerCallback = %callback;
|
||||
$ColorCallbackType = 2; // ColorF
|
||||
|
||||
// Set the RGBA displays accordingly
|
||||
%red = getWord(%currentColor, 0);
|
||||
%green = getWord(%currentColor, 1);
|
||||
%blue = getWord(%currentColor, 2);
|
||||
%alpha = getWord(%currentColor, 3);
|
||||
|
||||
setColorInfo(%red, %green, %blue, %alpha);
|
||||
|
||||
ColorBlendSelect.pickColor = %red SPC %green SPC %blue SPC "1.0";
|
||||
ColorBlendSelect.updateColor();
|
||||
ColorAlphaSelect.setValue(%alpha);
|
||||
|
||||
Canvas.pushDialog(ColorPickerDlg);
|
||||
}
|
||||
|
||||
|
||||
function DoColorPickerCallback()
|
||||
{
|
||||
eval( $ColorPickerCallback @ "(\"" @ constructNewColor(ColorBlendSelect.getValue(), $ColorCallbackType) @"\");" );
|
||||
|
||||
Canvas.popDialog(ColorPickerDlg);
|
||||
}
|
||||
|
||||
// This function updates the base color on the blend control
|
||||
function updatePickerBaseColor()
|
||||
{
|
||||
%pickColor = ColorRangeSelect.getValue();
|
||||
%red = getWord(%pickColor, 0);
|
||||
%green = getWord(%pickColor, 1);
|
||||
%blue = getWord(%pickColor, 2);
|
||||
|
||||
ColorBlendSelect.baseColor = %red SPC %green SPC %blue SPC "1.0";
|
||||
ColorBlendSelect.updateColor();
|
||||
}
|
||||
|
||||
// This function is used to update the text controls at the top
|
||||
function setColorInfo(%red, %green, %blue, %alpha)
|
||||
{
|
||||
Channel_R_Val.setValue("R :" SPC mCeil(%red * 255));
|
||||
Channel_G_Val.setValue("G :" SPC mCeil(%green * 255));
|
||||
Channel_B_Val.setValue("B :" SPC mCeil(%blue * 255));
|
||||
Channel_A_Val.setValue("A :" SPC mCeil(%alpha * 255));
|
||||
}
|
||||
|
||||
// This function constructs a new color, and updates the text displays accordingly
|
||||
function constructNewColor(%pickColor, %colorType )
|
||||
{
|
||||
%red = getWord(%pickColor, 0);
|
||||
%green = getWord(%pickColor, 1);
|
||||
%blue = getWord(%pickColor, 2);
|
||||
%alpha = ColorAlphaSelect.getValue();
|
||||
|
||||
// Update the text controls to reflect new color
|
||||
setColorInfo(%red, %green, %blue, %alpha);
|
||||
if ( %colorType == 1 ) // ColorI
|
||||
return mCeil( %red * 255 ) SPC mCeil( %green * 255 ) SPC mCeil( %blue * 255 ) SPC mCeil( %alpha * 255 );
|
||||
else // ColorF
|
||||
return %red SPC %green SPC %blue SPC %alpha;
|
||||
}
|
||||
|
||||
|
||||
// Functions to deal with the color dropper
|
||||
function startColorDropper()
|
||||
{
|
||||
//ColorPickerDlg.command = "ColorDropperSelect.baseColor = ColorPickerDlg.pickColor;";
|
||||
ColorPickerDlg.altCommand = $pickerUpdateControl@".setValue(constructNewColor(ColorPickerDlg.pickColor));endColorDropper();";
|
||||
ColorPickerDlg.setActive(true);
|
||||
$pickerActive = true;
|
||||
}
|
||||
|
||||
function endColorDropper()
|
||||
{
|
||||
ColorPickerDlg.command = "";
|
||||
ColorPickerDlg.altCommand = "";
|
||||
ColorPickerDlg.setActive(false);
|
||||
$pickerActive = false;
|
||||
}
|
||||
|
||||
function toggleColorPicker()
|
||||
{
|
||||
if ($pickerActive)
|
||||
endColorDropper();
|
||||
else
|
||||
startColorDropper();
|
||||
}
|
218
example/common/ui/ConsoleDlg.gui
Executable file
@ -0,0 +1,218 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(ConsoleDlg) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
|
||||
new GuiWindowCtrl(ConsoleDlgWindow) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "500 300";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "Console";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "1";
|
||||
MinSize = "500 300";
|
||||
closeCommand = "ToggleConsole(1);";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "3 36";
|
||||
extent = "494 246";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOn";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
|
||||
new GuiConsole() {
|
||||
profile = "GuiConsoleProfile";
|
||||
position = "0 0";
|
||||
};
|
||||
};
|
||||
new GuiConsoleEditCtrl(ConsoleEntry) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "top";
|
||||
position = "3 278";
|
||||
extent = "494 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
altCommand = "ConsoleEntry::eval();";
|
||||
maxLength = "255";
|
||||
historySize = "20";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "1";
|
||||
useSiblingScroller = "1";
|
||||
};
|
||||
new GuiPaneControl(ConsoleErrorPane) {
|
||||
profile = "GuiPaneProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
position = "3 22";
|
||||
extent = "474 85";
|
||||
minExtent = "474 10";
|
||||
visible = "1";
|
||||
caption = "No script compilation errors occured.";
|
||||
collapsable = "1";
|
||||
barBehindText = "1";
|
||||
|
||||
new GuiScrollCtrl(ConsoleErrorScroller) {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
position = "0 14";
|
||||
extent = "474 71";
|
||||
minExtent = "8 2";
|
||||
visible = "0";
|
||||
willFirstRespond = "0";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "1";
|
||||
childMargin = "0 0";
|
||||
|
||||
new GuiMLTextCtrl(ConsoleErrorDisplay) {
|
||||
profile = "GuiMLTextProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
position = "2 2";
|
||||
extent = "474 14";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
function ConsoleDlg::onWake()
|
||||
{
|
||||
%position = $pref::Console::position;
|
||||
if(%position $= "")
|
||||
%position = ConsoleDlgWindow.position;
|
||||
|
||||
%extent = $pref::Console::extent;
|
||||
if(getWord(%extent, 0) < getWord(ConsoleDlgWindow.minExtent, 0) ||
|
||||
getWord(%extent, 1) < getWord(ConsoleDlgWindow.minExtent, 1))
|
||||
%extent = ConsoleDlgWindow.extent;
|
||||
|
||||
ConsoleDlgWindow.resize(getWord(%position, 0), getWord(%position, 1),
|
||||
getWord(%extent, 0), getWord(%extent, 1));
|
||||
}
|
||||
|
||||
function ConsoleDlg::onSleep()
|
||||
{
|
||||
$pref::Console::position = ConsoleDlgWindow.position;
|
||||
$pref::Console::extent = ConsoleDlgWindow.extent;
|
||||
}
|
||||
|
||||
function ConsoleEntry::eval()
|
||||
{
|
||||
%text = trim(ConsoleEntry.getValue());
|
||||
|
||||
if(strpos(%text, "(") == -1)
|
||||
{
|
||||
if(strpos(%text, "=") == -1 && strpos(%text, " ") == -1)
|
||||
{
|
||||
if(strpos(%text, "{") == -1 && strpos(%text, "}") == -1)
|
||||
{
|
||||
%text = %text @ "()";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%pos = strlen(%text) - 1;
|
||||
if(strpos(%text, ";", %pos) == -1 && strpos(%text, "}") == -1)
|
||||
{
|
||||
%text = %text @ ";";
|
||||
}
|
||||
|
||||
echo("==>" @ %text);
|
||||
eval(%text);
|
||||
ConsoleEntry.setValue("");
|
||||
|
||||
// Check for any pending errors to display
|
||||
updateConsoleErrorWindow();
|
||||
}
|
||||
|
||||
function ToggleConsole(%make)
|
||||
{
|
||||
if (%make)
|
||||
{
|
||||
if (ConsoleDlg.isAwake())
|
||||
{
|
||||
// Deactivate the console.
|
||||
|
||||
if ( $enableDirectInput )
|
||||
activateKeyboard();
|
||||
Canvas.popDialog(ConsoleDlg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $enableDirectInput )
|
||||
deactivateKeyboard();
|
||||
Canvas.pushDialog(ConsoleDlg, 99);
|
||||
|
||||
// Check for any pending errors to display
|
||||
updateConsoleErrorWindow();
|
||||
|
||||
// Collapse the errors if this is the first time...
|
||||
if(ConsoleErrorPane._initialized == false)
|
||||
ConsoleErrorPane.setCollapsed(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The first hash is 1000...
|
||||
$ScriptErrorHashDisplayed = 999;
|
||||
|
||||
function updateConsoleErrorWindow()
|
||||
{
|
||||
if($ScriptErrorHash != $ScriptErrorHashDisplayed && $ScriptErrorHash != 0)
|
||||
{
|
||||
// Hash was different so there must be a new error. Update the display!
|
||||
|
||||
%oldText = ConsoleErrorDisplay.getText();
|
||||
|
||||
if(%oldText !$= "")
|
||||
ConsoleErrorDisplay.setText(%oldText @ "\n" @ $ScriptError);
|
||||
else
|
||||
ConsoleErrorDisplay.setText($ScriptError);
|
||||
|
||||
ConsoleErrorDisplay.setCursorPosition(100000); // Hacka hacka hacka
|
||||
ConsoleErrorDisplay.scrollToBottom();
|
||||
|
||||
// Update the pane caption.
|
||||
$ConsoleErrorCount += $ScriptErrorHash - $ScriptErrorHashDisplayed;
|
||||
ConsoleErrorPane.caption = $ConsoleErrorCount @ " script compilation error(s) have occured!";
|
||||
|
||||
// Indicate we dealt with this...
|
||||
$ScriptErrorHashDisplayed = $ScriptErrorHash;
|
||||
$ScriptError = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
29
example/common/ui/FrameOverlayGui.gui
Executable file
@ -0,0 +1,29 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(FrameOverlayGui) {
|
||||
profile = "GuiModelessDialogProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "True";
|
||||
setFirstResponder = "True";
|
||||
modal = "false";
|
||||
helpTag = "0";
|
||||
noCursor = true;
|
||||
|
||||
new GuiConsoleTextCtrl(TextOverlayControl) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "5 5";
|
||||
extent = "15 18";
|
||||
minExtent = "8 8";
|
||||
visible = "True";
|
||||
setFirstResponder = "True";
|
||||
modal = "True";
|
||||
helpTag = "0";
|
||||
expression = "10";
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
94
example/common/ui/HelpDlg.gui
Executable file
@ -0,0 +1,94 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(HelpDlg) {
|
||||
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 = "75 36";
|
||||
extent = "483 393";
|
||||
minExtent = "300 200";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Help";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "1";
|
||||
canMaximize = "1";
|
||||
minSize = "50 50";
|
||||
closeCommand = "Canvas.popDialog(HelpDlg);";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "height";
|
||||
position = "8 26";
|
||||
extent = "132 356";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
|
||||
new GuiTextListCtrl(HelpFileList) {
|
||||
profile = "GuiTextListProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "1 1";
|
||||
extent = "130 8";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
};
|
||||
};
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "146 26";
|
||||
extent = "328 356";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
|
||||
new GuiMLTextCtrl(HelpText) {
|
||||
profile = "GuiMLTextProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
position = "1 1";
|
||||
extent = "310 16";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
206
example/common/ui/LoadFileDlg.gui
Executable file
@ -0,0 +1,206 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(LoadFileDlg) {
|
||||
Profile = "GuiDialogProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = "800 600";
|
||||
MinExtent = "8 8";
|
||||
Visible = "1";
|
||||
fitParentHeight = "0";
|
||||
fitParentWidth = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
Profile = "GuiWindowProfile";
|
||||
HorizSizing = "center";
|
||||
VertSizing = "center";
|
||||
Position = "36 33";
|
||||
Extent = "589 372";
|
||||
MinExtent = "8 8";
|
||||
Visible = "1";
|
||||
text = "Open File...";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "1";
|
||||
canMaximize = "1";
|
||||
MinSize = "50 50";
|
||||
closeCommand = "Canvas.popDialog(LoadFileDlg);";
|
||||
fitParentHeight = "0";
|
||||
fitParentWidth = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "GuiButtonProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "top";
|
||||
Position = "449 343";
|
||||
Extent = "60 20";
|
||||
MinExtent = "8 8";
|
||||
Visible = "1";
|
||||
Command = "DoOpenFileExCallback();";
|
||||
text = "Load";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
fitParentHeight = "0";
|
||||
fitParentWidth = "0";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "GuiButtonProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "top";
|
||||
Position = "519 343";
|
||||
Extent = "60 20";
|
||||
MinExtent = "8 8";
|
||||
Visible = "1";
|
||||
Command = "Canvas.popDialog(LoadFileDlg);";
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
fitParentHeight = "0";
|
||||
fitParentWidth = "0";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiFrameSetCtrl() {
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
Position = "4 24";
|
||||
Extent = "579 310";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
columns = "0 245";
|
||||
rows = "0";
|
||||
borderWidth = "7";
|
||||
borderColor = "206 206 206 206";
|
||||
borderEnable = "dynamic";
|
||||
borderMovable = "dynamic";
|
||||
autoBalance = "0";
|
||||
fudgeFactor = "0";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
Profile = "GuiScrollProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = "238 310";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
fitParentHeight = "1";
|
||||
fitParentWidth = "0";
|
||||
|
||||
new GuiDirectoryTreeCtrl(LoadDirTreeEx) {
|
||||
Profile = "GuiDirectoryTreeProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "2 2";
|
||||
Extent = "85 63";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
tabSize = "16";
|
||||
textOffset = "2";
|
||||
fullRowSelect = "0";
|
||||
itemHeight = "21";
|
||||
destroyTreeOnSleep = "0";
|
||||
MouseDragging = "0";
|
||||
MultipleSelections = "0";
|
||||
fitParentHeight = "0";
|
||||
fitParentWidth = "0";
|
||||
};
|
||||
};
|
||||
new GuiScrollCtrl() {
|
||||
Profile = "GuiScrollProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "245 0";
|
||||
Extent = "334 310";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOn";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
fitParentHeight = "1";
|
||||
fitParentWidth = "1";
|
||||
|
||||
new GuiDirectoryFileListCtrl(LoadFileListEx) {
|
||||
Profile = "GuiDirectoryFileListProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "2 2";
|
||||
Extent = "623 208";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
fitParentHeight = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// ex: getLoadFilename("~/stuff/*.*", openStuff);
|
||||
// -- calls 'openStuff(%filename)' on dblclick or ok
|
||||
//------------------------------------------------------------------------------
|
||||
function getLoadFilename(%filespec, %callback, %currentFile)
|
||||
{
|
||||
$GuiLoadDialogCallback = %callback;
|
||||
if( %filespec $= "" )
|
||||
$LoadFileExFileSpec = "*.*";
|
||||
else
|
||||
$LoadFileExFileSpec = %filespec;
|
||||
|
||||
Canvas.pushDialog(LoadFileDlg, 99);
|
||||
|
||||
$LoadFileExFile = %currentFile;
|
||||
|
||||
// If we have a current path, set the tree to it
|
||||
if( filePath( %currentFile ) !$= "" )
|
||||
LoadDirTreeEx.setSelectedPath( filePath( %currentFile ) );
|
||||
|
||||
// Update our file view to reflect the changes
|
||||
LoadFileListEx.setPath( LoadDirTreeEx.getSelectedPath(), $LoadFileExFileSpec );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
function DoOpenFileExCallback()
|
||||
{
|
||||
%path = LoadDirTreeEx.getSelectedPath();
|
||||
%file = LoadFileListEx.getSelectedFile();
|
||||
%cat = %path @ "/" @ %file;
|
||||
|
||||
// MEOW
|
||||
eval( $GuiLoadDialogCallback @ "(\"" @ %cat @"\");" );
|
||||
|
||||
Canvas.popDialog(LoadFileDlg);
|
||||
}
|
||||
|
||||
function LoadDirTreeEx::onSelectPath( %this, %path )
|
||||
{
|
||||
// Update our file view to reflect the changes
|
||||
LoadFileListEx.setPath( %path, $LoadFileExFileSpec );
|
||||
}
|
||||
|
||||
|
||||
function LoadFileListEx::onDoubleClick(%this)
|
||||
{
|
||||
DoOpenFileExCallback();
|
||||
}
|
73
example/common/ui/MessageBoxOKCancelDlg.gui
Executable file
@ -0,0 +1,73 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(MessageBoxOKCancelDlg) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl(MBOKCancelFrame) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "170 175";
|
||||
extent = "300 129";
|
||||
minExtent = "48 92";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
|
||||
new GuiMLTextCtrl(MBOKCancelText) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "bottom";
|
||||
position = "32 39";
|
||||
extent = "236 24";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "158 88";
|
||||
extent = "110 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "MessageCallback(MessageBoxOKCancelDlg,MessageBoxOKCancelDlg.callback);";
|
||||
accelerator = "return";
|
||||
helpTag = "0";
|
||||
text = "OK";
|
||||
simpleStyle = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "30 88";
|
||||
extent = "110 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "MessageCallback(MessageBoxOKCancelDlg,MessageBoxOKCancelDlg.cancelCallback);";
|
||||
accelerator = "escape";
|
||||
helpTag = "0";
|
||||
text = "CANCEL";
|
||||
simpleStyle = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
59
example/common/ui/MessageBoxOkDlg.gui
Executable file
@ -0,0 +1,59 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(MessageBoxOKDlg) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl(MBOKFrame) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "170 175";
|
||||
extent = "300 129";
|
||||
minExtent = "48 92";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
|
||||
new GuiMLTextCtrl(MBOKText) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "bottom";
|
||||
position = "32 39";
|
||||
extent = "236 24";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "95 88";
|
||||
extent = "110 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "MessageCallback(MessageBoxOKDlg,MessageBoxOKDlg.callback);";
|
||||
accelerator = "return";
|
||||
helpTag = "0";
|
||||
text = "OK";
|
||||
simpleStyle = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
73
example/common/ui/MessageBoxYesNoDlg.gui
Executable file
@ -0,0 +1,73 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(MessageBoxYesNoDlg) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl(MBYesNoFrame) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "170 175";
|
||||
extent = "300 129";
|
||||
minExtent = "48 92";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
|
||||
new GuiMLTextCtrl(MBYesNoText) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "bottom";
|
||||
position = "32 39";
|
||||
extent = "236 24";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "158 88";
|
||||
extent = "110 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "MessageCallback(MessageBoxYesNoDlg,MessageBoxYesNoDlg.yesCallback);";
|
||||
accelerator = "return";
|
||||
helpTag = "0";
|
||||
text = "YES";
|
||||
simpleStyle = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "30 88";
|
||||
extent = "110 23";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "MessageCallback(MessageBoxYesNoDlg,MessageBoxYesNoDlg.noCallback);";
|
||||
accelerator = "escape";
|
||||
helpTag = "0";
|
||||
text = "NO";
|
||||
simpleStyle = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
45
example/common/ui/MessagePopupDlg.gui
Executable file
@ -0,0 +1,45 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(MessagePopupDlg) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl(MessagePopFrame) {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "170 175";
|
||||
extent = "300 92";
|
||||
minExtent = "48 92";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
|
||||
new GuiMLTextCtrl(MessagePopText) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "bottom";
|
||||
position = "32 39";
|
||||
extent = "236 24";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
182
example/common/ui/NetGraphGui.gui
Executable file
@ -0,0 +1,182 @@
|
||||
// Profiles
|
||||
new GuiControlProfile (NetGraphGhostsActiveProfile)
|
||||
{
|
||||
fontColor = "255 255 255";
|
||||
};
|
||||
new GuiControlProfile (NetGraphGhostUpdatesProfile)
|
||||
{
|
||||
fontColor = "255 0 0";
|
||||
};
|
||||
new GuiControlProfile (NetGraphBitsSentProfile)
|
||||
{
|
||||
fontColor = "0 255 0";
|
||||
};
|
||||
new GuiControlProfile (NetGraphBitsReceivedProfile)
|
||||
{
|
||||
fontColor = "0 0 255";
|
||||
};
|
||||
new GuiControlProfile (NetGraphLatencyProfile)
|
||||
{
|
||||
fontColor = "0 255 255";
|
||||
};
|
||||
new GuiControlProfile (NetGraphPacketLossProfile)
|
||||
{
|
||||
fontColor = "0 0 0";
|
||||
};
|
||||
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(NetGraphGui) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
noCursor = "1";
|
||||
|
||||
new GuiGraphCtrl(NetGraph) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "432 5";
|
||||
extent = "200 200";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
};
|
||||
|
||||
new GuiTextCtrl(Latency) {
|
||||
profile = "NetGraphLatencyProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "436 184";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "Latency";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl(PacketLoss) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "536 184";
|
||||
extent = "59 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "Packet Loss";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl(BitsReceived) {
|
||||
profile = "NetGraphBitsReceivedProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "536 170";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "Bits Received";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl(GhostsActive) {
|
||||
profile = "NetGraphGhostsActiveProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "436 156";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "Ghosts Active";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl(GhostUpdates) {
|
||||
profile = "NetGraphGhostUpdatesProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "536 156";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "Ghost Updates";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextCtrl(BitsSent) {
|
||||
profile = "NetGraphBitsSentProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
position = "436 170";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "Bits Sent";
|
||||
maxLength = "255";
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
// Functions
|
||||
function NetGraph::toggleNetGraph()
|
||||
{
|
||||
if(!$NetGraph::isInitialized)
|
||||
{
|
||||
$Stats::netGhostUpdates = 0;
|
||||
NetGraph::updateStats();
|
||||
$NetGraph::isInitialized = true;
|
||||
}
|
||||
|
||||
if(!Canvas.isMember(NetGraphGui))
|
||||
{
|
||||
Canvas.add(NetGraphGui);
|
||||
}
|
||||
else
|
||||
Canvas.remove(NetGraphGui);
|
||||
}
|
||||
|
||||
function NetGraph::updateStats()
|
||||
{
|
||||
$NetGraphThread = NetGraph.schedule(32, "updateStats");
|
||||
|
||||
if(!$Stats::netGhostUpdates)
|
||||
return;
|
||||
|
||||
if(isobject(NetGraph))
|
||||
{
|
||||
if(isobject(ServerConnection))
|
||||
NetGraph.addDatum(0,ServerConnection.getGhostsActive());
|
||||
GhostsActive.setText("Ghosts Active: " @ ServerConnection.getGhostsActive());
|
||||
NetGraph.addDatum(1,$Stats::netGhostUpdates);
|
||||
GhostUpdates.setText("Ghost Updates: " @ $Stats::netGhostUpdates);
|
||||
$Stats::netGhostUpdates = 0;
|
||||
NetGraph.addDatum(2,$Stats::netBitsSent);
|
||||
BitsSent.setText("Bits Sent: " @ $Stats::netBitsSent);
|
||||
NetGraph.addDatum(3,$Stats::netBitsReceived);
|
||||
BitsReceived.setText("Bits Received: " @ $Stats::netBitsReceived);
|
||||
NetGraph.matchScale(2,3);
|
||||
NetGraph.addDatum(4,ServerConnection.getPing());
|
||||
Latency.setText("Latency: " @ ServerConnection.getPing());
|
||||
NetGraph.addDatum(5,ServerConnection.getPacketLoss());
|
||||
PacketLoss.setText("Packet Loss: " @ ServerConnection.getPacketLoss());
|
||||
}
|
||||
}
|
||||
|
||||
function NetGraph::toggleKey()
|
||||
{
|
||||
if(!GhostsActive.visible)
|
||||
{
|
||||
GhostsActive.visible = 1;
|
||||
GhostUpdates.visible = 1;
|
||||
BitsSent.visible = 1;
|
||||
BitsReceived.visible = 1;
|
||||
Latency.visible = 1;
|
||||
PacketLoss.visible = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
GhostsActive.visible = 0;
|
||||
GhostUpdates.visible = 0;
|
||||
BitsSent.visible = 0;
|
||||
BitsReceived.visible = 0;
|
||||
Latency.visible = 0;
|
||||
PacketLoss.visible = 0;
|
||||
}
|
||||
}
|
97
example/common/ui/RecordingsDlg.gui
Executable file
@ -0,0 +1,97 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(recordingsDlg) {
|
||||
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 = "55 65";
|
||||
extent = "530 338";
|
||||
minExtent = "48 92";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Demo Recordings";
|
||||
maxLength = "255";
|
||||
resizeWidth = "0";
|
||||
resizeHeight = "0";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
closeCommand = "Canvas.popDialog(recordingsDlg);";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "23 37";
|
||||
extent = "484 260";
|
||||
minExtent = "32 32";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
defaultLineHeight = "15";
|
||||
|
||||
new GuiTextListCtrl(RecordingsDlgList) {
|
||||
profile = "GuiTextArrayProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "2 2";
|
||||
extent = "462 20";
|
||||
minExtent = "8 20";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
enumerate = "0";
|
||||
columns = "0";
|
||||
resizeCell = "1";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
noDuplicates = "false";
|
||||
};
|
||||
};
|
||||
new GuiButtonCtrl(DR_CancelBtn) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "396 306";
|
||||
extent = "110 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.popDialog(recordingsDlg);";
|
||||
accelerator = "escape";
|
||||
helpTag = "0";
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
new GuiButtonCtrl(DR_StartDemoBtn) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "25 305";
|
||||
extent = "110 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "StartSelectedDemo();";
|
||||
helpTag = "0";
|
||||
text = "Play";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
245
example/common/ui/SaveFileDlg.gui
Executable file
@ -0,0 +1,245 @@
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(SaveFileDlgEx) {
|
||||
profile = "GuiDialogProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fitParentWidth = "0";
|
||||
fitParentHeight = "0";
|
||||
position = "0 0";
|
||||
extent = "800 600";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
fitParentWidth = "0";
|
||||
fitParentHeight = "0";
|
||||
position = "73 61";
|
||||
extent = "653 478";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
text = "Save File...";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "1";
|
||||
canMaximize = "1";
|
||||
MinSize = "50 50";
|
||||
closeCommand = "Canvas.popDialog(SaveFileDlgEx);";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "top";
|
||||
fitParentWidth = "0";
|
||||
fitParentHeight = "0";
|
||||
position = "513 449";
|
||||
extent = "60 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "DoSaveFileExCallback();";
|
||||
text = "Save";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "left";
|
||||
vertSizing = "top";
|
||||
fitParentWidth = "0";
|
||||
fitParentHeight = "0";
|
||||
position = "583 449";
|
||||
extent = "60 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
command = "Canvas.popDialog(SaveFileDlgEx);";
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "10 449";
|
||||
extent = "89 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "File name:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextEditCtrl(SaveFileExEdit) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "60 449";
|
||||
extent = "286 16";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
};
|
||||
|
||||
new GuiFrameSetCtrl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
fitParentWidth = "0";
|
||||
fitParentHeight = "0";
|
||||
position = "4 24";
|
||||
extent = "643 416";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
columns = "0 245";
|
||||
rows = "0";
|
||||
borderWidth = "7";
|
||||
borderColor = "206 206 206 206";
|
||||
borderEnable = "dynamic";
|
||||
borderMovable = "dynamic";
|
||||
autoBalance = "0";
|
||||
fudgeFactor = "0";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fitParentWidth = "0";
|
||||
fitParentHeight = "1";
|
||||
position = "0 0";
|
||||
extent = "238 416";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
|
||||
new GuiDirectoryTreeCtrl(SaveDirTreeEx) {
|
||||
profile = "GuiDirectoryTreeProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fitParentWidth = "0";
|
||||
fitParentHeight = "0";
|
||||
position = "2 -670";
|
||||
extent = "206 1470";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
tabSize = "16";
|
||||
textOffset = "2";
|
||||
fullRowSelect = "0";
|
||||
itemHeight = "21";
|
||||
destroyTreeOnSleep = "0";
|
||||
MouseDragging = "0";
|
||||
MultipleSelections = "0";
|
||||
};
|
||||
};
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fitParentWidth = "1";
|
||||
fitParentHeight = "1";
|
||||
position = "245 0";
|
||||
extent = "643 416";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOn";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
|
||||
new GuiDirectoryFileListCtrl(SaveFileListEx) {
|
||||
profile = "GuiDirectoryFileListProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fitParentWidth = "0";
|
||||
fitParentHeight = "0";
|
||||
position = "2 2";
|
||||
extent = "621 224";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0";
|
||||
fitParentWidth = "1";
|
||||
clipColumnText = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// ex: getSaveFilenameEx("~/stuff/*.*", saveStuff);
|
||||
// -- calls 'saveStuff(%filename)' on ok
|
||||
//------------------------------------------------------------------------------
|
||||
function getSaveFilename(%filespec, %callback, %currentFile)
|
||||
{
|
||||
$GuiSaveDialogCallback = %callback;
|
||||
if( %filespec $= "" )
|
||||
$SaveFileExFileSpec = "*.*";
|
||||
else
|
||||
$SaveFileExFileSpec = %filespec;
|
||||
|
||||
Canvas.pushDialog(SaveFileDlgEx, 99);
|
||||
|
||||
$SaveFileExFile = %currentFile;
|
||||
|
||||
// If we have a current path, set the tree to it
|
||||
if( filePath( %currentFile ) !$= "" )
|
||||
SaveDirTreeEx.setSelectedPath( filePath( %currentFile ) );
|
||||
else if ( $pref::Constructor::lastPath !$= "" )
|
||||
SaveDirTreeEx.setSelectedPath( $pref::Constructor::lastPath );
|
||||
|
||||
// Update our file view to reflect the changes
|
||||
SaveFileListEx.setPath( SaveDirTreeEx.getSelectedPath(), $SaveFileExFileSpec );
|
||||
|
||||
// Update the file edit control
|
||||
SaveFileExEdit.setText(fileName($SaveFileExFile));
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
function DoSaveFileExCallback()
|
||||
{
|
||||
%path = SaveDirTreeEx.getSelectedPath();
|
||||
%file = SaveFileExEdit.getValue();
|
||||
%cat = %path @ "/" @ %file;
|
||||
|
||||
// MEOW
|
||||
echo(%cat);
|
||||
|
||||
eval( $GuiSaveDialogCallback @ "(\"" @ %cat @"\");" );
|
||||
|
||||
Canvas.popDialog(SaveFileDlgEx);
|
||||
}
|
||||
|
||||
function SaveDirTreeEx::onSelectPath( %this, %path )
|
||||
{
|
||||
// Update our file view to reflect the changes
|
||||
SaveFileListEx.setPath( %path, $SaveFileExFileSpec );
|
||||
|
||||
$pref::Constructor::lastPath = %path;
|
||||
}
|
||||
|
||||
function SaveFileListEx::onSelect( %this, %listid, %file )
|
||||
{
|
||||
// Update our file name to the one selected
|
||||
SaveFileExEdit.setText( %file );
|
||||
}
|
BIN
example/common/ui/audio.png
Executable file
After Width: | Height: | Size: 434 B |
BIN
example/common/ui/cache/Arial 12 (ansi).uft
vendored
Executable file
BIN
example/common/ui/cache/Arial 13 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Arial 14 (ansi).uft
vendored
Executable file
BIN
example/common/ui/cache/Arial 15 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Arial 16 (ansi).uft
vendored
Executable file
BIN
example/common/ui/cache/Arial 24 (ansi).uft
vendored
Executable file
BIN
example/common/ui/cache/Arial Bold 14 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Arial Bold 16 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Arial Bold 18 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Arial Bold 19 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Arial Bold 20 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Arial Bold 24 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Arial Bold 32 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Courier New 14 (ansi).uft
vendored
Normal file
BIN
example/common/ui/cache/Lucida Console 12 (ansi).uft
vendored
Executable file
33
example/common/ui/cache/clipboard.gui
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
new SimSet(guiClipboard) {
|
||||
|
||||
new GuiBitmapButtonCtrl() {
|
||||
Profile = "GuiButtonProfile";
|
||||
HorizSizing = "relative";
|
||||
VertSizing = "relative";
|
||||
position = "22 280";
|
||||
Extent = "182 58";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
Command = "Theo.setFile(\"demo/data/video/areTorquePopular.ogg\");";
|
||||
text = "Button";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
bitmap = "demo/client/ui/theora/button";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiMLTextCtrl() {
|
||||
Profile = "GuiMLTextNoSelectProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "9 7";
|
||||
Extent = "100 42";
|
||||
MinExtent = "8 2";
|
||||
Visible = "1";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
text = "<color:ffffff><font:Arial Bold:14>A demo of \nsome of Torque\'s \nlovely goodness.";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
};
|
BIN
example/common/ui/camera.png
Executable file
After Width: | Height: | Size: 353 B |
BIN
example/common/ui/darkBorder.png
Executable file
After Width: | Height: | Size: 8.5 KiB |
BIN
example/common/ui/darkScroll.png
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
example/common/ui/darkTab.png
Executable file
After Width: | Height: | Size: 33 KiB |
BIN
example/common/ui/darkTabPage.png
Executable file
After Width: | Height: | Size: 30 KiB |
BIN
example/common/ui/darkWindow.png
Executable file
After Width: | Height: | Size: 2.9 KiB |
BIN
example/common/ui/default.png
Executable file
After Width: | Height: | Size: 322 B |
644
example/common/ui/defaultProfiles.cs
Executable file
@ -0,0 +1,644 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
$Gui::fontCacheDirectory = expandFilename("./cache");
|
||||
$Gui::clipboardFile = expandFilename("./cache/clipboard.gui");
|
||||
|
||||
// GuiDefaultProfile is a special case, all other profiles are initialized
|
||||
// to the contents of this profile first then the profile specific
|
||||
// overrides are assigned.
|
||||
|
||||
if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile)
|
||||
{
|
||||
tab = false;
|
||||
canKeyFocus = false;
|
||||
hasBitmapArray = false;
|
||||
mouseOverSelected = false;
|
||||
|
||||
// fill color
|
||||
opaque = false;
|
||||
fillColor = ($platform $= "macos") ? "211 211 211" : "192 192 192";
|
||||
fillColorHL = ($platform $= "macos") ? "244 244 244" : "220 220 220";
|
||||
fillColorNA = ($platform $= "macos") ? "244 244 244" : "220 220 220";
|
||||
|
||||
// border color
|
||||
border = false;
|
||||
borderColor = "0 0 0";
|
||||
borderColorHL = "128 128 128";
|
||||
borderColorNA = "64 64 64";
|
||||
|
||||
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";
|
||||
|
||||
|
||||
// bitmap information
|
||||
bitmap = ($platform $= "macos") ? "./osxWindow" : "./darkWindow";
|
||||
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 = "";
|
||||
};
|
||||
|
||||
if(!isObject(GuiInputCtrlProfile)) new GuiControlProfile( GuiInputCtrlProfile )
|
||||
{
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiDialogProfile)) new GuiControlProfile(GuiDialogProfile);
|
||||
|
||||
|
||||
if(!isObject(GuiSolidDefaultProfile)) new GuiControlProfile (GuiSolidDefaultProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiWindowProfile)) new GuiControlProfile (GuiWindowProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = 2;
|
||||
fillColor = ($platform $= "macos") ? "211 211 211" : "192 192 192";
|
||||
fillColorHL = ($platform $= "macos") ? "190 255 255" : "64 150 150";
|
||||
fillColorNA = ($platform $= "macos") ? "255 255 255" : "150 150 150";
|
||||
fontColor = ($platform $= "macos") ? "0 0 0" : "255 255 255";
|
||||
fontColorHL = ($platform $= "macos") ? "200 200 200" : "0 0 0";
|
||||
text = "GuiWindowCtrl test";
|
||||
bitmap = ($platform $= "macos") ? "./osxWindow" : "./darkWindow";
|
||||
textOffset = ($platform $= "macos") ? "5 5" : "6 6";
|
||||
hasBitmapArray = true;
|
||||
justify = ($platform $= "macos") ? "center" : "left";
|
||||
};
|
||||
|
||||
if(!isObject(GuiToolWindowProfile)) new GuiControlProfile (GuiToolWindowProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = 2;
|
||||
fillColor = "192 192 192";
|
||||
fillColorHL = "64 150 150";
|
||||
fillColorNA = "150 150 150";
|
||||
fontColor = "255 255 255";
|
||||
fontColorHL = "0 0 0";
|
||||
bitmap = "./torqueToolWindow";
|
||||
textOffset = "6 6";
|
||||
};
|
||||
|
||||
if( !isObject(GuiTabBookProfile) ) new GuiControlProfile (GuiTabBookProfile)
|
||||
{
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "64 150 150";
|
||||
fillColorNA = "150 150 150";
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fontColorNA = "0 0 0";
|
||||
justify = "center";
|
||||
bitmap = "./darkTab";
|
||||
tabWidth = 64;
|
||||
tabHeight = 24;
|
||||
tabPosition = "Top";
|
||||
tabRotation = "Horizontal";
|
||||
tab = true;
|
||||
cankeyfocus = true;
|
||||
};
|
||||
|
||||
if( !isObject(GuiTabPageProfile) ) new GuiControlProfile (GuiTabPageProfile)
|
||||
{
|
||||
bitmap = "./darkTabPage";
|
||||
tab = true;
|
||||
};
|
||||
|
||||
|
||||
if(!isObject(GuiContentProfile)) new GuiControlProfile (GuiContentProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
};
|
||||
|
||||
if(!isObject(GuiModelessDialogProfile)) new GuiControlProfile("GuiModelessDialogProfile")
|
||||
{
|
||||
modal = false;
|
||||
};
|
||||
|
||||
if(!isObject(GuiButtonProfile)) new GuiControlProfile (GuiButtonProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = true;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
};
|
||||
|
||||
if(!isObject(GuiBorderButtonProfile)) new GuiControlProfile (GuiBorderButtonProfile)
|
||||
{
|
||||
fontColorHL = "0 0 0";
|
||||
};
|
||||
|
||||
if(!isObject(GuiMenuBarProfile)) new GuiControlProfile (GuiMenuBarProfile)
|
||||
{
|
||||
|
||||
fontType = "Arial";
|
||||
fontSize = 15;
|
||||
opaque = true;
|
||||
fillColor = ($platform $= "macos") ? "211 211 211" : "192 192 192";
|
||||
fillColorHL = "0 0 96";
|
||||
border = 4;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "128 128 128";
|
||||
fixedExtent = true;
|
||||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
mouseOverSelected = true;
|
||||
bitmap = ($platform $= "macos") ? "./osxMenu" : "./torqueMenu";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiButtonSmProfile)) new GuiControlProfile (GuiButtonSmProfile : GuiButtonProfile)
|
||||
{
|
||||
fontSize = 14;
|
||||
};
|
||||
|
||||
if(!isObject(GuiRadioProfile)) new GuiControlProfile (GuiRadioProfile)
|
||||
{
|
||||
fontSize = 14;
|
||||
fillColor = "232 232 232";
|
||||
fontColorHL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
bitmap = ($platform $= "macos") ? "./osxRadio" : "./torqueRadio";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiScrollProfile)) new GuiControlProfile (GuiScrollProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
border = 3;
|
||||
borderThickness = 2;
|
||||
borderColor = "0 0 0";
|
||||
bitmap = ($platform $= "macos") ? "./osxScroll" : "./darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(VirtualScrollProfile)) new GuiControlProfile (VirtualScrollProfile : GuiScrollProfile);
|
||||
|
||||
if(!isObject(GuiSliderProfile)) new GuiControlProfile (GuiSliderProfile);
|
||||
|
||||
if(!isObject(GuiTextProfile)) new GuiControlProfile (GuiTextProfile)
|
||||
{
|
||||
fontColor = "0 0 0";
|
||||
fontColorLink = "255 96 96";
|
||||
fontColorLinkHL = "0 0 255";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiMediumTextProfile)) new GuiControlProfile (GuiMediumTextProfile : GuiTextProfile)
|
||||
{
|
||||
fontSize = 24;
|
||||
};
|
||||
|
||||
if(!isObject(GuiBigTextProfile)) new GuiControlProfile (GuiBigTextProfile : GuiTextProfile)
|
||||
{
|
||||
fontSize = 36;
|
||||
};
|
||||
|
||||
if(!isObject(GuiCenterTextProfile)) new GuiControlProfile (GuiCenterTextProfile : GuiTextProfile)
|
||||
{
|
||||
justify = "center";
|
||||
};
|
||||
|
||||
if(!isObject(GuiTextEditProfile)) new GuiControlProfile (GuiTextEditProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
border = 3;
|
||||
borderThickness = 2;
|
||||
borderColor = "0 0 0";
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "128 128 128";
|
||||
textOffset = "0 2";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = true;
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiControlListPopupProfile)) new GuiControlProfile (GuiControlListPopupProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
border = true;
|
||||
borderColor = "0 0 0";
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "128 128 128";
|
||||
textOffset = "0 2";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = true;
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
bitmap = ($platform $= "macos") ? "./osxScroll" : "./darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiTextArrayProfile)) new GuiControlProfile (GuiTextArrayProfile : GuiTextProfile)
|
||||
{
|
||||
fontColorHL = "32 100 100";
|
||||
fillColorHL = "200 200 200";
|
||||
};
|
||||
|
||||
if(!isObject(GuiTextListProfile)) new GuiControlProfile (GuiTextListProfile : GuiTextProfile)
|
||||
{
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiBaseTreeViewProfile)) new GuiControlProfile (GuiBaseTreeViewProfile)
|
||||
{
|
||||
fontSize = 13; // dhc - trying a better fit...
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "64 150 150";
|
||||
canKeyFocus = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiChatMenuTreeProfile)) new GuiControlProfile (GuiChatMenuTreeProfile : GuiBaseTreeViewProfile);
|
||||
|
||||
if(!isObject(GuiTreeViewProfile)) new GuiControlProfile (GuiTreeViewProfile : GuiBaseTreeViewProfile)
|
||||
{
|
||||
fontColorSEL= "250 250 250";
|
||||
fillColorHL = "0 60 150";
|
||||
fontColorNA = "240 240 240";
|
||||
bitmap = "./shll_treeView";
|
||||
};
|
||||
|
||||
if(!isObject(GuiDirectoryTreeProfile)) new GuiControlProfile ( GuiDirectoryTreeProfile : GuiTreeViewProfile )
|
||||
{
|
||||
fontColor = "40 40 40";
|
||||
fontColorSEL= "250 250 250 175";
|
||||
fillColorHL = "0 60 150";
|
||||
fontColorNA = "240 240 240";
|
||||
bitmap = "./shll_treeView";
|
||||
fontType = "Arial";
|
||||
fontSize = 14;
|
||||
};
|
||||
|
||||
if(!isObject(GuiDirectoryFileListProfile)) new GuiControlProfile ( GuiDirectoryFileListProfile )
|
||||
{
|
||||
fontColor = "40 40 40";
|
||||
fontColorSEL= "250 250 250 175";
|
||||
fillColorHL = "0 60 150";
|
||||
fontColorNA = "240 240 240";
|
||||
fontType = "Arial";
|
||||
fontSize = 14;
|
||||
};
|
||||
|
||||
|
||||
|
||||
if(!isObject(GuiCheckBoxProfile)) 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 = ($platform $= "macos") ? "./osxCheck" : "./torqueCheck";
|
||||
hasBitmapArray = true;
|
||||
|
||||
};
|
||||
|
||||
if(!isObject(GuiPopUpMenuProfile)) new GuiControlProfile (GuiPopUpMenuProfile)
|
||||
{
|
||||
opaque = true;
|
||||
mouseOverSelected = true;
|
||||
|
||||
border = 4;
|
||||
borderThickness = 2;
|
||||
borderColor = "0 0 0";
|
||||
fontSize = 14;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fontColorSEL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
justify = "center";
|
||||
bitmap = ($platform $= "macos") ? "./osxScroll" : "./darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(LoadTextProfile)) new GuiControlProfile ("LoadTextProfile")
|
||||
{
|
||||
fontColor = "66 219 234";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
|
||||
if(!isObject(GuiMLTextProfile)) new GuiControlProfile ("GuiMLTextProfile")
|
||||
{
|
||||
fontColorLink = "255 96 96";
|
||||
fontColorLinkHL = "0 0 255";
|
||||
};
|
||||
|
||||
if(!isObject(GuiMLTextNoSelectProfile)) new GuiControlProfile ("GuiMLTextNoSelectProfile")
|
||||
{
|
||||
fontColorLink = "255 96 96";
|
||||
fontColorLinkHL = "0 0 255";
|
||||
modal = false;
|
||||
};
|
||||
|
||||
if(!isObject(GuiMLTextEditProfile)) new GuiControlProfile (GuiMLTextEditProfile)
|
||||
{
|
||||
fontColorLink = "255 96 96";
|
||||
fontColorLinkHL = "0 0 255";
|
||||
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "128 128 128";
|
||||
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiToolTipProfile)) new GuiControlProfile (GuiToolTipProfile)
|
||||
{
|
||||
tab = false;
|
||||
canKeyFocus = false;
|
||||
hasBitmapArray = false;
|
||||
mouseOverSelected = false;
|
||||
|
||||
// fill color
|
||||
opaque = true;
|
||||
fillColor = "255 255 225";
|
||||
|
||||
// border color
|
||||
border = true;
|
||||
borderColor = "0 0 0";
|
||||
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "0 0 0";
|
||||
fontColorNA = "0 0 0";
|
||||
|
||||
|
||||
// used by guiTextControl
|
||||
modal = true;
|
||||
justify = "left";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = false;
|
||||
returnTab = false;
|
||||
numbersOnly = false;
|
||||
cursorColor = "0 0 0 255";
|
||||
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Console Window
|
||||
|
||||
if(!isObject(GuiConsoleProfile)) new GuiControlProfile ("GuiConsoleProfile")
|
||||
{
|
||||
fontType = ($platform $= "macos") ? "Monaco" : "Lucida Console";
|
||||
fontSize = ($platform $= "macos") ? 13 : 12;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "130 130 130";
|
||||
fontColorNA = "255 0 0";
|
||||
fontColors[6] = "50 50 50";
|
||||
fontColors[7] = "50 50 0";
|
||||
fontColors[8] = "0 0 50";
|
||||
fontColors[9] = "0 50 0";
|
||||
};
|
||||
|
||||
|
||||
if(!isObject(GuiProgressProfile)) new GuiControlProfile ("GuiProgressProfile")
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "44 152 162 100";
|
||||
border = true;
|
||||
borderColor = "78 88 120";
|
||||
};
|
||||
|
||||
if(!isObject(GuiProgressTextProfile)) new GuiControlProfile ("GuiProgressTextProfile")
|
||||
{
|
||||
fontColor = "0 0 0";
|
||||
justify = "center";
|
||||
};
|
||||
|
||||
if(!isObject(GuiBitmapBorderProfile)) new GuiControlProfile(GuiBitmapBorderProfile)
|
||||
{
|
||||
bitmap = "./darkBorder";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiPaneProfile)) new GuiControlProfile(GuiPaneProfile)
|
||||
{
|
||||
bitmap = "./torquePane";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Gui Inspector Profiles
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Field Profile
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if(!isObject(GuiInspectorFieldProfile)) new GuiControlProfile (GuiInspectorFieldProfile)
|
||||
{
|
||||
// fill color
|
||||
opaque = false;
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
fillColorNA = "244 244 244";
|
||||
|
||||
// border color
|
||||
border = false;
|
||||
borderColor = "190 190 190";
|
||||
borderColorHL = "156 156 156";
|
||||
borderColorNA = "64 64 64";
|
||||
|
||||
bevelColorHL = "255 255 255";
|
||||
bevelColorLL = "0 0 0";
|
||||
|
||||
// font
|
||||
fontType = "Arial";
|
||||
fontSize = 16;
|
||||
|
||||
fontColor = "32 32 32";
|
||||
fontColorHL = "32 100 100";
|
||||
fontColorNA = "0 0 0";
|
||||
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
|
||||
};
|
||||
|
||||
if(!isObject(GuiInspectorBackgroundProfile)) new GuiControlProfile (GuiInspectorBackgroundProfile : GuiInspectorFieldProfile)
|
||||
{
|
||||
border = 5;
|
||||
};
|
||||
|
||||
if(!isObject(GuiInspectorDynamicFieldProfile)) new GuiControlProfile (GuiInspectorDynamicFieldProfile : GuiInspectorFieldProfile);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Default Field (TextEdit) Profile
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if(!isObject(GuiInspectorTextEditProfile)) new GuiControlProfile ("GuiInspectorTextEditProfile")
|
||||
{
|
||||
// Transparent Background
|
||||
opaque = false;
|
||||
|
||||
// No Border (Rendered by field control)
|
||||
border = false;
|
||||
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
|
||||
// font
|
||||
fontType = "Arial";
|
||||
fontSize = 16;
|
||||
|
||||
fontColor = "32 32 32";
|
||||
fontColorHL = "32 100 100";
|
||||
fontColorNA = "0 0 0";
|
||||
|
||||
};
|
||||
|
||||
if(!isObject(InspectorTypeEnumProfile)) new GuiControlProfile (InspectorTypeEnumProfile : GuiInspectorFieldProfile)
|
||||
{
|
||||
mouseOverSelected = true;
|
||||
bitmap = ($platform $= "macos") ? "./osxScroll" : "./darkScroll";
|
||||
hasBitmapArray = true;
|
||||
opaque=true;
|
||||
border=true;
|
||||
};
|
||||
|
||||
if(!isObject(InspectorTypeCheckboxProfile)) new GuiControlProfile (InspectorTypeCheckboxProfile : GuiInspectorFieldProfile)
|
||||
{
|
||||
bitmap = ($platform $= "macos") ? "./osxCheck" : "./torqueCheck";
|
||||
hasBitmapArray = true;
|
||||
opaque=false;
|
||||
border=false;
|
||||
};
|
||||
|
||||
// For TypeFileName browse button
|
||||
if(!isObject(GuiInspectorTypeFileNameProfile)) new GuiControlProfile (GuiInspectorTypeFileNameProfile)
|
||||
{
|
||||
// Transparent Background
|
||||
opaque = false;
|
||||
|
||||
// No Border (Rendered by field control)
|
||||
border = 5;
|
||||
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
|
||||
// font
|
||||
fontType = "Arial";
|
||||
fontSize = 16;
|
||||
|
||||
// Center text
|
||||
justify = "center";
|
||||
|
||||
fontColor = "32 32 32";
|
||||
fontColorHL = "32 100 100";
|
||||
fontColorNA = "0 0 0";
|
||||
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
fillColorNA = "244 244 244";
|
||||
|
||||
borderColor = "190 190 190";
|
||||
borderColorHL = "156 156 156";
|
||||
borderColorNA = "64 64 64";
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------- Cursors
|
||||
//
|
||||
new GuiCursor(DefaultCursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
renderOffset = "0 0";
|
||||
bitmapName = "./CUR_3darrow";
|
||||
};
|
||||
|
||||
new GuiCursor(LeftRightCursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
renderOffset = "0.5 0";
|
||||
bitmapName = "./CUR_leftright";
|
||||
};
|
||||
|
||||
new GuiCursor(UpDownCursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
renderOffset = "0 1";
|
||||
bitmapName = "./CUR_updown";
|
||||
};
|
||||
|
||||
new GuiCursor(NWSECursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
renderOffset = "0.5 0.5";
|
||||
bitmapName = "./CUR_nwse";
|
||||
};
|
||||
|
||||
new GuiCursor(NESWCursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
renderOffset = "0.5 0.5";
|
||||
bitmapName = "./CUR_nesw";
|
||||
};
|
||||
|
||||
new GuiCursor(MoveCursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
renderOffset = "0.5 0.5";
|
||||
bitmapName = "./CUR_move";
|
||||
};
|
||||
|
||||
new GuiCursor(TextEditCursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
renderOffset = "0.5 0.5";
|
||||
bitmapName = "./CUR_textedit";
|
||||
};
|
BIN
example/common/ui/folder.png
Executable file
After Width: | Height: | Size: 795 B |
BIN
example/common/ui/folder_closed.png
Executable file
After Width: | Height: | Size: 763 B |
BIN
example/common/ui/fxfoliage.png
Executable file
After Width: | Height: | Size: 380 B |
BIN
example/common/ui/fxlight.png
Executable file
After Width: | Height: | Size: 588 B |
BIN
example/common/ui/fxshapereplicator.png
Executable file
After Width: | Height: | Size: 225 B |
BIN
example/common/ui/fxsunlight.png
Executable file
After Width: | Height: | Size: 683 B |
BIN
example/common/ui/hidden.png
Executable file
After Width: | Height: | Size: 281 B |
BIN
example/common/ui/icon.png
Executable file
After Width: | Height: | Size: 629 B |
BIN
example/common/ui/inspector_delete_d.png
Executable file
After Width: | Height: | Size: 465 B |
BIN
example/common/ui/inspector_delete_h.png
Executable file
After Width: | Height: | Size: 453 B |
BIN
example/common/ui/inspector_delete_i.png
Executable file
After Width: | Height: | Size: 453 B |