Game Development Community

How to use datablocks with GUIs?

by Adam Johnston · in Torque Game Builder · 03/23/2006 (9:50 am) · 4 replies

Hi there
I'm doing an animated GUI and right now I'm using code like this
%imgCtrl.setBitmap ("./jt_demo/client/images/numbers/num_int_09");
    ...
    %imgCtrl.setBitmap ("./jt_demo/client/images/numbers/num_int_10");
I was thinking if it was possible to use datablocks for this.
Somebody has done this before?

#1
03/23/2006 (3:28 pm)
I'm not sure what you need for this GUI, but there are a few ways to get animations in a GUI. One is a resource engine patch, here www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3952
The other is using multiple SceneWindows as described here on TDN. tdn.garagegames.com/wiki/Torque_2D/StandardTutorials/Basics/GuiScene

After testing both I decided to go with a variant of the SceneWindow method... because that way seems more flexible, allows more than just simple animation, and it doesn't need to touch the engine source.
#2
03/23/2006 (3:39 pm)
Thank you @Joe :)
I'll give a look at the second method too.
#3
03/23/2006 (9:57 pm)
In the latest Beta 2 (listed still as beta 1.1 but the file is Beta2) there is a gui t2d scene object :) This will accomplish what you want, just give it a name in the GUI editor, then go to the console and to a .dump() to it and you should find all the functions needed, such as setSceneObject().
#4
03/23/2006 (9:59 pm)
Just to add more this means you can create a static sprite or an animated sprite and set it to the GUI object and then play any animations needed :) ITs what the new object libarary uses (you can thank Melv for the GUI object addition).