Game Development Community

Static Sprite to Gui

by Taras (TSK) Anatsko · in Torque Game Builder · 11/16/2007 (12:23 pm) · 5 replies

How i can move Static Sprite from sceneWindows2D to Gui control? I want to do something like inventory. For example when i pick up coin it must apear in inventory.

#1
11/18/2007 (4:33 pm)
You'd most likely want to leave the GUI Builder out of it. It just causes headaches and back pain as well as slight dementia. I'd suggest perhaps creating a different scenegraph for your GUI elements, but make them scene objects.
#2
11/18/2007 (5:21 pm)
Here you go:

%t2dContainer = new guiT2DObjectCtrl()
{
	RenderMargin = 3;
	extent = "100 100";
	position = "0 0";
	toolType = "t2dSceneObject";
	tooltip = "Scene Object";
	toolTipProfile = "EditorToolTipProfile";
};

%sceneGraph = new t2dSceneGraph();
%sceneObject = new t2dStaticSprite() { scenegraph = %Scenegraph; datablock = %datablock};
//%scenObject = new t2dAnimatedSprite() { scenegraph = %Scenegraph; animation= %datablock};

%t2dContainer.setSceneObject(%sceneObject);
#3
11/19/2007 (5:06 am)
Thanks Phillip,

you have 1 mistake in code, but this is no problem =)
And now i need to include T2DObjectCtrl in engine, right? because i have

game/gameScripts/game.cs (47): Unable to instantiate non-conobject class guiT2DObjectCtrl.
#4
01/21/2008 (5:15 am)
Helo!
I'm trying to set up t2dObjectCtrl in TGB (Indie licence, so I can't access C++ code).
While loading/compiling code with declaration of new guit2dObjectCtrl I'm getting following error:
"Unable to instantiate non-conobject class guiT2DObjectCtrl."

Smth. has changed in TGB 1.6 or am I missing smth?

Thx.
#5
01/21/2008 (10:31 am)
Adam,

You need TGB Pro in order to add T2dObjectCtrl to the engine.

As I said before, you could use scene objects on a different scenegraph that is on a different scenewindow. I'd recommend programming some kind of hierarchy system into you scene object gui, though. Of course, you won't have all the nifty GUI controls available, but for unique cases such as an inventory, it doesn't matter very much.