getShapeInstance(); TSShape "> Problem while using GFX->DrawText() | Torque Game Engine Advanced | Forums | Community | GarageGames.com

Game Development Community

Problem while using GFX->DrawText()

by Yang Deqian · in Torque Game Engine Advanced · 10/16/2007 (10:18 pm) · 0 replies

Code Picture:
ShowTSCtrl *tsCtrl = NULL;

tsCtrl = static_cast(Sim::findObject("myDtsCtrl"));

if( !tsCtrl)
return;
TSShapeInstance * inst = tempShape->getShapeInstance();
TSShape * shapeInst = inst->getShape();

int maxNode = shapeInst->nodes.size();

for( int i = 0; i < maxNode; i++ )
{

MatrixF rotation;
rotation.mul( tempShape->getTransform(), inst->mNodeTransforms[i]);
Point3F currPos = rotation.getPosition();
Point3F currRot;
rotation.getColumn( 1, &currRot );

Point3F dest;
tsCtrl->project( currPos, &dest );
Point2I screenDest;
screenDest.x = dest.x;
screenDest.y = dest.y;

char * name = "abcdefg";
screenDest.x -= tsCtrl->mProfile->mFont->getStrWidth((const UTF8 *)name) / 2;
screenDest.y -= tsCtrl->mProfile->mFont->getHeight();

GFX->setBitmapModulation(ColorI(128,128,128));
GFX->drawText( tsCtrl->mProfile->mFont, screenDest, name );
GFX->clearBitmapModulation();
..................
the screenDest looks fine but GFX draw's the Text( name ) too big, and too much gradient, and with wrong place .........
any ideas? 3ks a lot!