GUI/Overview

From TDN

Contents

Overview

All games require a Graphical User Interface (GUI) of some kind. Whether it's the menu screen, an in-game Heads-Up Display (HUD), or an options dialog, every game needs GUI controls which can receive user input and display results in a visual fashion.

The GUI is important because it is the interface players of your game will use constantly, every time they play. Most often, your menu GUI is the first thing players see in a game. Designing intuitive, easy to use interfaces that gamers interact with is a major part of game design.

Torque's GUI system is powerful and flexible. It offers precise control over your game's interfaces and allows you to create most any interface you can imagine.

Torque Game Engine and Torque Game Builder come with the built-in GUI Editor (a feature offered by few other game engines). Your knowing how to utilize the GUI Editor to its fullest potential is very important to your game's success.

What is a GUI

As mentioned above, "GUI" stands for Graphical User Interface. It is the summation of all the controls (windows, buttons, text fields, etc) that are used to interact with a game and its settings. Most GUI interfaces in games consist of buttons to launch or join a game session, editing devices to change user preferences, options to change screen resolutions and rendering options, and elements which display game data to the user as they are playing.

GUI Structure

Your game will consist of a number of controls, each an instance of GuiControl or a subclass thereof, arranged in a tree structure. The root is installed in the Canvas as its content.

Each control has a parent control, along with sibling controls and child controls of its own.

GUI Profiles

Torque's GUI structure is somewhat confusing to see at first. The simplest way to explain this would be the following; the GUI is governed by a set of laws, which are laid out through two core profile files, defaultProfiles.cs (in common/gui) and customProfiles.cs (in MyGame/client/ui/).

The defaultProfile.cs is the core file in which all the look (colors, fonts, sizes, bitmap arrays, etc.) and reactions in the GUI are stored. The customProfiles.cs is a file that can be seen to be a copy of the defaultProfiles.cs, but one which can override elements of the GUI that you define. This means that for example, if you want to change the cursor image, you simply edit customProfile.cs with your new info. This means that your changes stay separate from Torque's GUI and ensures that if something goes wrong you can fall back to a working file by simple copy-paste.