Game Development Community

GUI/Fonts/Custom controls

by Gerald Fishel · in Torque Game Builder · 03/13/2006 (9:09 pm) · 3 replies

Hi all,

Just purchased TGB, and I want to get my feet wet. I have owned TGE for a while, and I know some about the scripting engine and have made many modifications to the C++ source. But I never did much with the GUI system in Torque. For my current needs, a good GUI is important. (I am developing a single player Texas Hold'em game.)

There are 2 initial items that would help me along the path greatly.

1) How (if possible) to set the font/size/color/ and text alignment of the text in controls like GuiBitmapButtonTextCtrl

and

2) How to create a custom control; i.e. I would like to handle the drawing, mouse and keyboard input, with C++, and have the control available in the GUI editor.

If anybody can point me to any resources that might be helpful in this regard, it would be greatly appreciated.

Thanks

#1
03/13/2006 (9:28 pm)
The GuiControlProfile handles text font/size/color/etc. In 1.1b check the common/gui/profiles.cs file for GuiDefaultProfile for a good starting place. You can define your own ControlProfiles in the same manner.

You'll want to sub-class the GuiControl object (or one of its existing children) in the source. Take one of the existing children as an example and clone it as a starting point. There might be a resource or a doc that outlines what you need to do to create an entirely new one from scratch but I always find it easier to copy something like GuiBitmapCtrl.* and change the references.
#2
03/13/2006 (9:32 pm)
Hi Luke,

Thanks for the help. I just figured out how to do the custom control right before checking back here, and I did it the same way you recommend, by copying the GuiBitmapButtonCtrl.*

Looking into GuiControlProfile now

Thanks
#3
03/13/2006 (9:39 pm)
Got the profiles figured out now too, thanks a bunch