Game Development Community

Dynamically Add GuiControls or override Draw functions

by Yannis Sovolakis · in Torque X 2D · 07/17/2008 (1:39 pm) · 5 replies

I have been trying to dynamically add some text on the screen either by adding gui controls on the canvas or by trying to find a way to override drawing of objects.

Had no results.

The only solution was to override Game.OnDraw and add some drawing there.
The problem is that it is impossible to select the exact layer that the results will show up.

Thank you in advance.

#2
07/17/2008 (9:52 pm)
Thank you for the response.

The issue here is that that post refers to Merging textures.

All I want is to dynamically draw an animated Text and a new texture around my Static or Dynamic sprites right after they render on the same Layer.
#3
07/18/2008 (6:37 am)
I don't think gui controls can do what you want since they are rendered after the scene (so you can't make them render on a particular layer). I think you need to have a static sprite in your scene with the layer set to what you want (or mounted to another object) and draw your text on its texture. That's why I was suggesting David Helmer's posting from July 7. Perhaps it could be used to draw your text on the texture of a static sprite.
#4
07/19/2008 (5:39 am)
Thank you very much.

You are very helpful.

In case this is the only valid way to go, my case is to draw moving / rotating text which changes its size as it moves follwing game sprites.

Do you think that I will have to implement a texture covering the whole screen and drawing on that one depending on the position and velocity of every item in the game?

Thank you again.
#5
07/19/2008 (7:14 am)
I haven't done this myself (yet ....) so I'm just guessing. I think using David Helmer's idea you could add a static sprite to your scene and draw text on it. You could mount this static sprite to your object and it would automatically follow the object around.