本文整理汇总了C++中GuiText::SetTextSize方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiText::SetTextSize方法的具体用法?C++ GuiText::SetTextSize怎么用?C++ GuiText::SetTextSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiText
的用法示例。
在下文中一共展示了GuiText::SetTextSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMsgRecv
void BroadcastConsole::OnMsgRecv(const std::string& str)
{
// Discard if same as last msg
if (!m_texts.empty())
{
if (m_texts[0]->GetText() == str)
{
std::cout << "Discarding duplicate msg\n";
return;
}
}
GuiText* text = new GuiText;
text->SetIsMulti(true);
text->SetTextSize(1.0f); // TODO CONFIG
text->SetSize(Vec2f(2.0f, 0.1f)); // assume single line
text->SetText(str);
text->SizeToText();
text->SetFgCol(Colour(1, 1, 0, 1));
m_texts.push_front(text);
static const unsigned int NUM_LINES = ROConfig()->GetInt("chat-max-lines", 10);
if (m_texts.size() > NUM_LINES)
{
m_texts.pop_back();
}
ReposText();
}
示例2: Draw
virtual void Draw()
{
// Don't draw name of local player ?
if (IsVisible() && m_player->GetId() != GetLocalPlayerId())
{
//Assert(m_player->GetAABB());
//DrawAABB(*(m_player->GetAABB()));
// Print name
// TODO Do all these in one go, to minimise state changes
AmjuGL::PushAttrib(AmjuGL::AMJU_BLEND | AmjuGL::AMJU_DEPTH_READ);
AmjuGL::Enable(AmjuGL::AMJU_BLEND);
AmjuGL::Disable(AmjuGL::AMJU_DEPTH_READ);
GuiText text;
text.SetTextSize(5.0f); // TODO CONFIG
text.SetText(m_player->GetName());
static const float MAX_NAME_WIDTH = 4.0f; // minimise this to reduce overdraw - calc from text
text.SetSize(Vec2f(MAX_NAME_WIDTH, 1.0f));
text.SetJust(GuiText::AMJU_JUST_CENTRE);
//text.SetInverse(true);
//text.SetDrawBg(true);
text.SetFgCol(Colour(1, 1, 1, 1));
AmjuGL::PushMatrix();
Matrix m;
m.SetIdentity();
// Reverse modelview rotation
Matrix r;
r.ModelView();
m = TransposeRot(r);
Vec3f tr(m_combined[12], m_combined[13], m_combined[14]);
m.TranslateKeepRotation(tr);
AmjuGL::MultMatrix(m);
static const float SCALE_FACTOR = 20.0f;
float x = MAX_NAME_WIDTH * SCALE_FACTOR * -0.5f;
AmjuGL::Translate(x, 60.0f, 0); // TODO CONFIG
AmjuGL::Scale(SCALE_FACTOR, SCALE_FACTOR, 10);
text.Draw();
AmjuGL::PopMatrix();
AmjuGL::PopAttrib();
}
}
示例3: Set
void LurkMsg::Set(const std::string& str, const Colour& fgCol, const Colour& bgCol, LurkPos lp,
CommandFunc onFinished)
{
GuiText* text = new GuiText;
if (lp == AMJU_CENTRE)
{
text->SetIsMulti(true);
}
text->SetTextSize(1.5f); // TODO CONFIG
text->SetSize(Vec2f(1.6f, 0.1f)); // assume single line
text->SetText(str);
text->SizeToText();
text->SetFgCol(fgCol);
Set(text, fgCol, bgCol, lp, onFinished);
}
示例4: tr
void Ve1NameNode::Draw()
{
// Print name
// TODO Do all these in one go, to minimise state changes
AmjuGL::PushAttrib(AmjuGL::AMJU_BLEND | AmjuGL::AMJU_DEPTH_READ);
AmjuGL::Enable(AmjuGL::AMJU_BLEND);
AmjuGL::Disable(AmjuGL::AMJU_DEPTH_READ);
GuiText text;
text.SetTextSize(5.0f); // TODO CONFIG
text.SetText(ToString(*m_obj));
static const float MAX_NAME_WIDTH = 4.0f; // minimise this to reduce overdraw - calc from text
text.SetSize(Vec2f(MAX_NAME_WIDTH, 1.0f));
text.SetJust(GuiText::AMJU_JUST_CENTRE);
//text.SetInverse(true);
//text.SetDrawBg(true);
AmjuGL::PushMatrix();
Matrix m;
m.SetIdentity();
//Vec3f tr(m_local[12], m_local[13], m_local[14]);
Vec3f tr(m_combined[12], m_combined[13], m_combined[14]);
m.Translate(tr);
AmjuGL::MultMatrix(m);
static const float SCALE_FACTOR = 20.0f;
float x = MAX_NAME_WIDTH * SCALE_FACTOR * -0.5f;
AmjuGL::Translate(x, 60.0f, 0); // TODO CONFIG
AmjuGL::Scale(SCALE_FACTOR, SCALE_FACTOR, 10);
text.Draw();
AmjuGL::PopMatrix();
AmjuGL::PopAttrib();
/*
AmjuGL::PushAttrib(
AmjuGL::AMJU_TEXTURE_2D | AmjuGL:: AMJU_LIGHTING | AmjuGL::AMJU_BLEND | AmjuGL::AMJU_DEPTH_READ | AmjuGL::AMJU_DEPTH_WRITE);
AmjuGL::Enable(AmjuGL::AMJU_TEXTURE_2D);
AmjuGL::Disable(AmjuGL::AMJU_LIGHTING);
AmjuGL::Enable(AmjuGL::AMJU_BLEND);
AmjuGL::Disable(AmjuGL::AMJU_DEPTH_READ);
AmjuGL::Disable(AmjuGL::AMJU_DEPTH_WRITE);
AmjuGL::PushMatrix();
AmjuGL::SetIdentity();
AmjuGL::SetMatrixMode(AmjuGL::AMJU_PROJECTION_MATRIX);
AmjuGL::PushMatrix();
AmjuGL::SetIdentity();
MultColour(Colour(0, 0, 1, 1));
GuiText text;
text.SetTextSize(0.5f);
std::string s = "Object " + ToString(m_obj->GetId()) + " " + m_obj->GetTypeName();
text.SetText(s);
text.SizeToText();
text.SetJust(GuiText::AMJU_JUST_LEFT);
text.SetLocalPos(screenpos);
text.Draw();
AmjuGL::PopMatrix();
AmjuGL::SetMatrixMode(AmjuGL::AMJU_MODELVIEW_MATRIX);
AmjuGL::PopMatrix();
AmjuGL::PopAttrib();
*/
}