Game Development Community

TorqueX GUI Question

by Luke Larson · in Torque X 2D · 01/23/2007 (7:29 pm) · 5 replies

I have to say that I am much more impressed with the GUI system in TorqueX than in TGB. Though I didn't have much GUI experience in TGB, I really enjoy TorqueX's content controlling etc. But not everything is perfect, thus my question is this:

I have created a simple GUISceneview class that implements the IGUIscreen interface. Normally you would create some HUD stuff (ie. score) in the constructor of this class but I need to be able to access this stuff from other classes as to be able to change the text that is displayed. Initially I was simply going to make the GUIText control that I wanted to access a public property, however, I could not figure out a way to access it through the GUICanvas. Next I figured I could just create the score text at the same time as I initialize the rest of the objects in my scene but this would require setting the Folder of the GUIText to be the same as the loaded GUI content in order for it to be displayed. Unfortunately, I could not figure this out as well.

Maybe?
scoretext.Folder = GUICanvas.Instance.Manager.CurrentFolder;
but that doesn't seem to do the trick.

Any ideas?
Let me know if I need to clarify.

#1
01/23/2007 (8:05 pm)
You don't want to make the HUD public to everyone. No one but the sceneview should get access to it. What you can do instead, is have a variable at game level (game.cs if you are using the tankbuster template) and update THAT text, which you then set within the tick of the sceneview class. Make sense?

#2
01/23/2007 (8:08 pm)
Ah yes, I guess I didn't realize that the sceneview could receive tick callbacks, but why wouldn't it be able to?

Thanks!
#3
01/24/2007 (3:58 am)
I'm pretty surprised to hear someone prefer the GUI system in TorqueX to that of TGB. It's essentially the same, but with much fewer features. I guess the Gui Builder makes the system look bad. :\

Heh, weird.
#4
01/24/2007 (6:26 am)
I guess I just never really got into the GUI system of TGB enough to recognize the similaritie, or maybe it's just that I prefer coding in C# rather than TorqueScript. In any case thanks for the responses.
#5
01/24/2007 (7:32 am)
*cough* XML GUI *cough* BETTER *cough* GET ER DONE *cough*