Game Development Community

dev|Pro Game Development Curriculum

MinApp Tutorial #2 - Torque Tools Support

by John Vanderbeck · 01/22/2004 (10:10 am) · 25 comments

Download Code File

MinApp Tutorial #2 - Torque Tools Support

The purpose of this tutorial is to add in support for the built in Torque tools -- The GUI editor and Mission/Terrain Editor.

Originally this was going to be done in two steps, with the GUI editor and Mission/Terrain editor handled individually. This turned out to not be practical, as the "editors" are all wrapped together in code.

As with tutorial #1, this tutorial will use some pre-existing files from the stock Toqrue demo application. We are obviously not going to recreate the editors.

1) Copy files from stock Torque Demo Application to MinApp
Copy the directory "editor" from the example/common to minapp/common
Copy the following files from example/common/ui to minapp/common/ui:
guiEditorGui.gui
inspectDlg.gui
frameOverlayGui.gui
LoadFileDlg.gui
MessagePopupDlg.gui
MessageBoxYesNoDlg.gui
MessageBoxOkDlg.gui
MessageBoxOkCancelDlg.gui
SaveFileDlg.gui
InspectAddFieldDlg.gui
torqueCheck.png
torqueMenu.png
torqueRadio.png

Copy messageBox.cs from example/common/client to minapp/common/client

In tutorial #1 we added additional default profile code to the file defaultProfiles.cs. A large amount of the default profiles were still missing, and are needed for this step in the process. Instead of going through and adding in every single default profile, I determined it was just better to simply copy the file over, giving us all the default profiles. This really has no effect on us pulling things out later, as we can always leave the default profiles in. They are usefull for things other than our tools.

Copy defaultProfiles.cs from example/common/ui to minapp/common/ui

2) Modify minapp/common/client/canvas.cs

We need to add in the exec() statements for our new UIs as well as one helper script. In the function initCanvas() add the code signified in bold below.

// Commonly used helper scripts
   exec("./cursor.cs");
[b]   exec("./messageBox.cs");[/b]
   
   // Common GUI's
   exec("~/ui/ConsoleDlg.gui");
[b]   exec("~/ui/GuiEditorGui.gui");
   exec("~/ui/InspectDlg.gui");
   exec("~/ui/LoadFileDlg.gui");
   exec("~/ui/SaveFileDlg.gui");
   exec("~/ui/MessageBoxOkDlg.gui");
   exec("~/ui/MessageBoxYesNoDlg.gui");
   exec("~/ui/MessageBoxOKCancelDlg.gui");
   exec("~/ui/MessagePopupDlg.gui");[/b]

What does this do?
What we have done here is pretty much the same thing we did in tutorial #1. We are setting our gui files to be ran at startup. The messageBox.cs file is a helper script for using message boxes in our application.

3) Modify minapp/common/main.cs

In the initCommon() function, we need to add in the script file which sets up all the editor functions. Once again, the code to be added is in bold.

function initCommon()
{
   // All mods need the random seed set
   setRandomSeed();

   // Very basic functions used by everyone
   exec("./client/canvas.cs");
   
[b]   // Editor support
   exec("./editor/editor.cs");[/b]
   
}

What does this do?
The script editor.cs initializes and sets up the editor for use.
Page «Previous 1 2
#1
01/28/2004 (3:32 am)
In step 1, you left out copying the folder "...\common\ui\cache" from the stock Torque example directory. Without this folder, the GUI Editor menus show up without a background.

Also, it might be worth mentioning (if you know) why editing some GUIs causes problem when you first come in. For example, start up your MinApp2 and press F10. Now select the button/pulldown that currently shows "MainMenuGui" and change that to almost any other Gui (I tried MessageBoxOkDlg) and it won't quite work. The main Gui shows up (you see the "tower" image) and the Gui you selectd, but you can't do anything with the Gui you selected.
#2
01/28/2004 (10:04 am)
1) You should not need to copy the cache folder. I didin't and it worked fine. I will check again to be positive.

2) That is a problem with the overlay menu. I mentioned it in the original forum thread about these tutorials. Once you delete the overaly in the next tutorial, that problem will go away.
#3
02/01/2004 (12:46 am)
Hi, I am unable to use F10 to load the editor. I received error: 'CreateBitmapArray - failed to get Sepearator color'. Could someone please explain how to fix this. I tried using the source code above to no avail. It's in relation to guitypes.cc within the main engine folder.
#4
02/02/2004 (5:06 am)
I will check this when I get home tonight.
#5
02/03/2004 (4:23 am)
Everything seems to work fine. I even downloaded the included archive, extracted it to a fresh directory and ran it, and it works fine. No error.

Sounds like its something to do with you specifically. Once thing I would ask, is what version of Torque are you using? I'm developing these against a HEAD checkout from January 15, 2004. If you are using a version older than that I would recommend chaecking out a new one and trying that.
#6
02/03/2004 (2:35 pm)
@John: Without copying the cache folder my menus weren't drawing correctly - they had transparent backgrounds and other weird artifacts.
#7
02/07/2004 (2:20 am)
John, had the same problem - it was fixed when I realiased I hadn't copied the defaultProfiles.cs file over again.

Richard
#8
04/04/2004 (2:06 pm)
Not sure that this made it the first time...

John, Thanks for the great tuts. Keep up the good work

I think Jasons problem is related to not copying over the required
.png files as listed above. So the engine complained. I did the same thing. Now it seems to be working just fine.

I know that this post is starting to gather dust, but, I figured that someone may need this info in the future.

W00t... my first post!

Ed
#9
05/22/2004 (3:50 am)
For those having problems like described by Dan, even after copying over the \ui\cache folder, delete all your .dso files so they get recompiled next run. I did this and it cleared up.
#10
06/10/2004 (10:58 am)
Hi guys

I didn't need to copy the cache folder to fix the transparency problem. All I did was remove the DSO files as recommended in the last tutorial and it worked fine.
#11
06/15/2004 (4:22 pm)
Hi good tutorials, I am learning. Just one thing on this one.

GUI editor, World editor, and Terrain editor ... you forgot to tell us how to pull each of these up to verify that it worked fine. I tried the F10, but I forgot if this function is for all the editors or just one of them. I will have to go back to the docs to see.
#12
06/15/2004 (4:26 pm)
As a test I wanted to see if i could run 2 different instances of the Torque engine at the same time. I executed this tutorial and then went back to another directory for the 1st tutorial and tried to execute it.

I was not able to run two instances. Is this possible, and if so, this would make a good tutorial also. Thanks.
#13
06/15/2004 (4:40 pm)
I created a batch file that I put at the root directory of MinApp to delete all the DSO files with a single click of a mouse.

For those that might not know how:
1) Open notepad
2) put this in notepad:
del *.dso /s
3) Files/Save As
4) Change the "Save as Type" from Text to All
5) Give it a name (I called it DeleteDSOs
#14
08/23/2004 (6:34 pm)
@John, I tried this tutorial but i'm having different error compared to the others before. instead of loading, i just got this error "GuiControlProfile: unable to find specified profile (GuiContentProfile) and GuiDefaultProfile does not exist!" I have the latest HEAD and follow what's stated above.
#15
08/24/2004 (12:02 am)
@John, Hi retried the tutorial again, started from scratch and know what it ran. Thanks John for the great tutorial! more power!!!
#16
12/23/2004 (12:56 pm)
@John, I tried your tutorial and it is great!
I use cvs to make sure I can not get lost during copy/edit sessions.
This will be a good working base for my projects.

Thank you
Michael
#17
02/17/2005 (12:25 pm)
Where do we get the editor.cs file?

Walter Lucman
Academic ADL Co-Lab
#18
02/26/2005 (1:35 am)
editor.cs is in common\editor directory
#19
05/02/2005 (12:28 pm)
For me the easiest way to delete all the .dso files is to use WinCVS.

I just select the parent directory and turn on flat-mode. Then I type in *.dso into the filter. Viola, all dso files under the parent directory are displayed. You can then select all of them and delete them.

There is one thing that I would watch-out for though. If you leave WinCVS in flat-mode and then accidentally select a large parent directory like "c:\", it can take a LONG time for WinCVS to display all the files. Not that I have ever made this mistake ;-)
#20
07/24/2006 (11:26 pm)
How come only GUI Editor works (F10)? World Editor doesn't.
EDIT: Argh, found it. Just missed a step.

Great tutorials by the way!
Page «Previous 1 2