T2dTextObject
by Kevin James · in Torque Game Builder · 03/16/2007 (10:48 am) · 2 replies
I need example code on how to manipulate the TextObject. I found this resource:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10136
But it is obviously outdated since none of those properties exist in 1.1.3.
Yes, I have the TGB reference guide, but it does not contain example code.
Thank you
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10136
But it is obviously outdated since none of those properties exist in 1.1.3.
Yes, I have the TGB reference guide, but it does not contain example code.
Thank you
About the author
Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/
#2
I always forget about the dump function...
03/16/2007 (12:11 pm)
Thanks David, that is a major help! I always forget about the dump function...
Associate David Higgins
DPHCoders.com
t2dTextObject derives from SceneObject, so it has all the generic properties and functions that other SceneObjects have in common, such as SetPosition, SetVelocity, RotateTo, MoveTo, etc, etc ... it also has the same Size/Position properties, etc, etc ... the main differences however, are the Font and Text properties -- not sure off hand what the Font property actually is, or if it needs to be set with a function or not, or is only available at creation ... you'll have to test that...
To change the text displayed in a t2dTextObject, you literally just give the .Text property a new value, and it auto-updates the t2dTextObject -- this was an experiment that GG was attempting to perform, which makes the Fields in SceneObjects more like 'Properties' (get/set style 'real' properties) ... this is one of the major reasons why t2dTextObject appears 'odd' at first glance ...
Thats all you have to do to change the display text -- as for setting the font, font style, etc ... I would suggest creating a t2dTextObject in the Level Builder, give it something other then default values for every possibly option in the Level Builder ... save the level, and examine the level.t2d file and look at the creation code -- the fields set during creation should either be available at run-time and able to be changed by accessing them directly, like you do with .Text, or by using a setField and getField style method ... such as setFont or setFontStyle, etc, etc ... the values available to these should be fairly obvious after looking at the code generated by Level Builder in the level.t2d file ...
Sorry I can't be more helpful, but I don't really use the t2dTextObject myself ...