本文整理汇总了C++中CFont::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::GetHeight方法的具体用法?C++ CFont::GetHeight怎么用?C++ CFont::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::GetHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void CCheckBox::Draw()
{
////////// Gee: janwas, this is just temp to see it
glDisable(GL_TEXTURE_2D);
//////////
float square_side, buffer_zone;
CStrW font_name;
bool checked;
int cell_id;
GUI<float>::GetSetting(this, "square_side", square_side);
GUI<float>::GetSetting(this, "buffer_zone", buffer_zone);
GUI<CStrW>::GetSetting(this, "font", font_name);
GUI<bool>::GetSetting(this, "checked", checked);
GUI<int>::GetSetting(this, "cell_id", cell_id);
// Get line height
CFont font (font_name);
float line_height = (float)font.GetHeight();
float bz = GetBufferedZ();
// Get square
CRect rect;
rect.left = m_CachedActualSize.left;
rect.right = rect.left + square_side;
if (square_side >= line_height)
rect.top = m_CachedActualSize.top;
else
rect.top = m_CachedActualSize.top + line_height/2.f - square_side/2.f;
rect.bottom = rect.top + square_side;
CGUISpriteInstance *sprite, *sprite_over, *sprite_pressed, *sprite_disabled;
if (checked)
{
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2", sprite);
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2_over", sprite_over);
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2_pressed", sprite_pressed);
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2_disabled", sprite_disabled);
}
else
{
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite", sprite);
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite_over", sprite_over);
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite_pressed", sprite_pressed);
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite_disabled", sprite_disabled);
}
DrawButton(rect,
bz,
*sprite,
*sprite_over,
*sprite_pressed,
*sprite_disabled,
cell_id);
CColor color = ChooseColor();
CPos text_pos(m_CachedActualSize.left + square_side + buffer_zone, m_CachedActualSize.top);
if (square_side > line_height)
text_pos.y += square_side/2.f - line_height/2.f;
IGUITextOwner::Draw(0, color, text_pos, bz+0.1f, m_CachedActualSize);
}