本文整理汇总了C++中GuiText::SetFontSize方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiText::SetFontSize方法的具体用法?C++ GuiText::SetFontSize怎么用?C++ GuiText::SetFontSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiText
的用法示例。
在下文中一共展示了GuiText::SetFontSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToString
void GSMain::Draw2d()
{
AmjuGL::Viewport(0, 0, Screen::X(), Screen::Y());
TheHud::Instance()->Draw();
// Store scaled modelview matrix
float mat[16];
AmjuGL::GetMatrix(AmjuGL::AMJU_MODELVIEW_MATRIX, mat);
// Split screen -- draw all screens
int numVps = TheViewportManager::Instance()->GetNumViewports();
for (int i = 0; i < numVps; i++)
{
AmjuGL::SetMatrixMode(AmjuGL::AMJU_MODELVIEW_MATRIX);
AmjuGL::SetIdentity();
// Restore scaled mv matrix
AmjuGL::MultMatrix(mat);
TheViewportManager::Instance()->GetViewport(i)->Draw2d();
}
m_gui->Draw(); // split screen line etc
TheLurker::Instance()->Draw();
#ifdef GEKKO
TheCursorManager::Instance()->Draw();
#endif
#ifdef SHOW_INFO
// TODO Switch on/off
if (true)
{
static GuiText t;
t.SetFgCol(Colour(1, 1, 1, 1));
t.SetBgCol(Colour(0, 0, 0, 1));
t.SetDrawBg(true);
t.SetFontSize(0.8f); // TODO CONFIG
t.SetIsMulti(true);
t.SetLocalPos(Vec2f(-1.0f, -0.8f));
t.SetSize(Vec2f(1.0f, 0.2f));
t.SetJust(GuiText::AMJU_JUST_LEFT);
float playerX = Player::GetPlayer(AMJU_P1)->GetPos().x;
static std::string old;
std::string s = "Depth: " + ToString((int)GetCurrentDepth()) +
" X: " + ToString((int)playerX) +
"\nNum Game Objects: " +
ToString((int)TheGame::Instance()->GetGameObjects()->size());
if (old != s)
{
t.SetText(s);
}
old = s;
t.Draw();
}
#endif // SHOW_INFO
}
示例2: Draw
void Hud::Draw()
{
float dt = TheTimer::Instance()->GetDt();
static const char* SCORE_NAME[3] =
{
"p1-score-text",
"p2-score-text",
"hi-score-text"
};
static const float origSize[3] =
{
dynamic_cast<GuiText*>(m_gui->GetElementByName(SCORE_NAME[0]))->GetFontSize(),
dynamic_cast<GuiText*>(m_gui->GetElementByName(SCORE_NAME[1]))->GetFontSize(),
dynamic_cast<GuiText*>(m_gui->GetElementByName(SCORE_NAME[2]))->GetFontSize()
};
for (int i = 0; i < 3; i++)
{
if (s_scoreExpandTimer[i] > 0)
{
s_scoreExpandTimer[i] -= dt;
if (s_scoreExpandTimer[i] < 0)
{
s_scoreExpandTimer[i] = 0;
}
GuiText* text = dynamic_cast<GuiText*>(m_gui->GetElementByName(SCORE_NAME[i]));
Assert(text);
static const float EXPAND_SCALE = ROConfig()->GetFloat("hud-expand-scale");
text->SetFontSize(origSize[i] * (s_scoreExpandTimer[i] * EXPAND_SCALE + 1.0f));
std::string s = text->GetText();
text->SetText("");
text->SetText(s); // force tri list rebuild
}
}
if (s_lifeTimer > 0)
{
s_lifeTimer -= dt;
if (s_lifeTimer < 0)
{
s_lifeTimer = 0;
}
static const char* GUI_NAME[4] =
{
"heart-img1",
"p1-lives-text",
"heart-img2",
"p2-lives-text"
};
float t = s_lifeTimer * 10;
bool vis = (((int)t % 2) == 0);
for (int i = 0; i < 4; i++)
{
GuiElement* elem = m_gui->GetElementByName(GUI_NAME[i]);
Assert(elem);
elem->SetVisible(vis);
}
}
m_gui->Draw();
}