In this section, you will see how easy it is to create and employ an interface using the Torque GUI Editor.
You should note that the Torque GUI Editor assumes your screen resolution is set to a minimum resolution of 800 600. You may find it more useful to use a higher resolution, to allow the different views more room to display their data.
Using Windows Explorer, browse into the C:\3DGPAi1 folder and then double-click on the Run fps Demo shortcut.
When the GarageGames/Torque menu screen appears, press the F10 key.
The editor controls will appear on the bottom and right side of the screen and enable you to immediately start editing the screen you were previously viewing.
Click the New button and enter a name for the new interface—do not use spaces in the name. Use "MyFirstInterface" for the name.
Leave the class as GuiControl, and then press the Create button. You will now have a nice new interface to work with.
In the Tree view, select the control named "MyFirstInterface". Its properties should appear in the Inspector view.
In the Inspector view, click the Expand button.
Locate the profile property and click the button next to it to get the pop-up menu.
Scroll through the menu until you locate the GuiContentProfile and select that.
Click Apply.
Now you have a Content Control to which you can add other controls.
Click the New Control button and choose GuiButtonCtrl from the pop-up menu.
Select the button using one of the two techniques you've learned (via the Content Editor or via the Control Tree).
Look in the Control Inspector view and locate the text property for this new control. Put some text in it.
Enter "quit();" in the command property.
Click Apply.
Click the Save button.
The Save feature will automatically use the top-level control in your interface for the file name, so leave that as is.
At the top of the Save dialog box is a button that you can use to select which folder in which to save the file. Choose the fps folder.
Click Save.
There, you've created an interface using the Torque GUI Editor!
Now let's break it! No…I mean, let's test it!
Open the console using the Tilde key ("~").
Type in the following, pressing the Enter key when you're done:
exec("fps/MyFirstInterface.gui");
Now type in the following, again pressing the Enter key when you're done:
canvas.setContent("MyFirstInterface");
Your interface should pop up on the screen. Just go ahead—press that button! Now you see that the whole program quits, because that's what you programmed it to do.
Of course, this is a simple interface. They can get as complex as you need. You can see that there is a lot of power available in Torque to address your interface needs. And if Torque doesn't have it, you can create it yourself!