Game Development Community

T2dTextObject - need to be created without text set

by Christian Rousselle · in Torque Game Builder · 03/30/2008 (3:32 pm) · 1 replies

A t2dTextObject needs to be created without the text set. Otherwise the calculation of the size of the text will not work. Maybe not a bug but at least now there is a thread for information.

%txtObj = new t2dTextObject()
{
	scenegraph = %this.scenegraph;
	font = "Arial";
//      text = "Text";  // will not work here 
	wordWrap = "0";
	hideOverflow = "0";
	textAlign = "Left";
	lineHeight = "50";
	aspectRatio = "1";
	lineSpacing = "0";
	characterSpacing = "0";
	autoSize = "1";
	fontSizes = "50";
	textColor = "1 1 1 1";
	hideOverlap = "0";
	layer = "0";
};

%txtObj.text = "Text";  // but here

www.codecoach.de/GG/tgb_err_t2dTextObj.jpg

#1
04/03/2008 (8:21 pm)
Wow, still bugs in t2dTextObject, eh? I wrote up my experiences with t2dTextObjects here and here.

The first link is in regard to fontsizes and is a bug I identified in TGB 1.1.3. I don't know if it's still an issue in 1.7.2. If you're running 1.7.2 could you follow the replication steps and see if it's still bogus?

The second link is to a bug from TGB 1.1.3. I just checked 1.7.2 and it's been [even more elegantly] fixed.

My game was extremely text-heavy. I spent lots of time dealing with t2dTextObject buts :p The final product is here.