本文整理汇总了C++中GuiText::SetScaleX方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiText::SetScaleX方法的具体用法?C++ GuiText::SetScaleX怎么用?C++ GuiText::SetScaleX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiText
的用法示例。
在下文中一共展示了GuiText::SetScaleX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunOneLoop
void Game::RunOneLoop()
{
#ifdef SHOW_FRAME_TIME
static std::string fps;
static int framesThisSec = 0;
framesThisSec++;
static int elapsed = 0;
float e = TheTimer::Instance()->GetElapsedTime();
if ((int)e != elapsed)
{
elapsed = (int)e;
fps = ToString(framesThisSec);
framesThisSec = 0;
}
#ifdef WIN32
unsigned long start = GetTickCount();
#else
// Get time taken to update/draw/flip, giving the 'real' FPS, not fixed to screen refresh rate
timeval tbefore;
gettimeofday(&tbefore, 0);
#endif
#endif // SHOW_FRAME_TIME
Update();
#ifdef SHOW_FRAME_TIME
#ifdef WIN32
unsigned long mid = GetTickCount();
#else
// Get time taken to update/draw/flip, giving the 'real' FPS, not fixed to screen refresh rate
timeval mid;
gettimeofday(&mid, 0);
#endif
#endif // SHOW_FRAME_TIME
Draw();
#ifdef SHOW_FRAME_TIME
if (m_font)
{
#ifdef WIN32
unsigned long draw = GetTickCount() - mid;
unsigned long update = mid - start;
std::string s = "Draw: " + ToString((unsigned int)draw) + " update: " + ToString((unsigned int)update);
#else
timeval tafter;
gettimeofday(&tafter, 0);
double draw = tafter.tv_sec - mid.tv_sec + (tafter.tv_usec - mid.tv_usec) * 1e-6;
double update = mid.tv_sec - tbefore.tv_sec + (mid.tv_usec - tbefore.tv_usec) * 1e-6;
int idraw = (int)(draw * 1000.0f);
int iupdate = (int)(update * 1000.0f);
std::string s = std::string("Draw: ") +
std::string((idraw < 10 ? "0" : "")) + ToString(idraw) +
std::string("ms update: ") + std::string((iupdate < 10 ? "0" : "")) +
ToString(iupdate) + "ms";
#endif
s += " fps: " + fps;
// Display time per frame
static GuiText t;
t.SetFont(m_font);
t.SetScaleX(0.7f);
t.SetFgCol(Colour(1, 1, 1, 1));
t.SetLocalPos(Vec2f(-1.0f, 1.0f));
t.SetSize(Vec2f(2.0f, 0.1f));
t.SetJust(GuiText::AMJU_JUST_LEFT);
t.SetText(s);
AmjuGL::PushAttrib(AmjuGL::AMJU_LIGHTING | AmjuGL::AMJU_TEXTURE_2D);
AmjuGL::Disable(AmjuGL::AMJU_LIGHTING);
AmjuGL::Enable(AmjuGL::AMJU_TEXTURE_2D);
t.Draw();
AmjuGL::PopAttrib();
}
#endif // SHOW_FRAME_TIME
AmjuGL::Flip();
}