Game Development Community

t2dTextObject not showing up on iphone or simulator

by Bret Patterson · in iTorque 2D · 05/10/2009 (3:36 pm) · 2 replies

I just recently add t2dTextObjects to all the characters in game and damage messages using t2dTextObjects and they work perfectly on the MAC in iTGB but when I run them on the simulator or on the iphone their invisible. Anyone know of any issues relating to this?

I'm creating everything in C++ code if that matters.

Here's the code I'm using
t2dVector mountOffset(0,0);
	mountOffset.mY -= 0.75;
	mDisplayName = new t2dTextObject();
	mDisplayName->setVisible(false);
	mDisplayName->setFont("Arial Bold");
	mDisplayName->removeAllFontSizes();
	mDisplayName->addFontSize(36.0);
	mDisplayName->setLineHeight(12.0);
	mDisplayName->setUsesPhysics(true);
	mDisplayName->registerObject();
	mOwner->getSceneGraph()->addToScene(mDisplayName);
	
	if (mName == NULL) {
		Con::errorf("(%s,%d) mName is null!",__FILE__,__LINE__);
	} else {
		mDisplayName->setText(mName);
	}
	t2dVector position = mOwner->getPosition();
	position.mY -= mOwner->getHalfSize().mY/2;
	//mDisplayName->setPosition(position);
	mDisplayName->setVisible(true);
	mDisplayName->setBlendColour(ColorF(1.0,1.0,1.0));
	mDisplayName->autoSize();
	mDisplayName->mount(mOwner,mountOffset, 0.0f, true, true, true, true);

#1
05/10/2009 (4:04 pm)
I found the problem. The iphone and simulator require only font's that are listed in the common/data/fonts/ while others will work on the mac. The problem was I was using a font size that was not supported, changing it to 20 worked.
IE:
changing:
mDisplayName->addFontSize(36.0);

TO

mDisplayName->addFontSize(20.0);
#2
05/11/2009 (11:21 pm)
Good fix. You probably also could have gotten around this by copying over the 36 point font to the project manually.