PDA

View Full Version : Text Entity for Debug output



BigBMan
12-27-2010, 03:14 PM
Any recommendations for making a text overlay for debug output? I was trying to do something that output accelerometer values but can't seem to get the text to change every frame...

BigBMan
12-27-2010, 04:27 PM
#ifdef _DEBUG

m_pAccelDisplayEnt = CreateTextLabelEntity(GetParent(), "AccelDebug", GetScreenSizeXf()/2, GetScreenSizeYf()-150, "Accel:");
AddFocusIfNeeded(m_pAccelDisplayEnt);
#endif


(OnAccel)

CL_Vec3f v = pVList->Get(1).GetVector3();

#ifdef _DEBUG
char strMsg[256];

sprintf(strMsg, "Acc: %f, %f, %f", v.x, v.y, v.z);

LogMsg("Acc: %f, %f, %f", v.x, v.y, v.z);

EntityComponent* comp = m_pAccelDisplayEnt->GetComponentByName("TextRender");
comp->GetVar("text")->Set(strMsg);
#endif