本文整理汇总了C++中CGUI::DrawText方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUI::DrawText方法的具体用法?C++ CGUI::DrawText怎么用?C++ CGUI::DrawText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUI
的用法示例。
在下文中一共展示了CGUI::DrawText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
_MEMBER_FUNCTION_IMPL(GUIFont, drawText)
{
CEGUI::Font * pFont = sq_getinstance<CEGUI::Font *>(pVM);
if(!pFont)
{
sq_pushbool(pVM, false);
return 1;
}
const char* text;
SQBool sbRelative;
float x, y;
sq_getfloat(pVM, -4, &x);
sq_getfloat(pVM, -3, &y);
sq_getstring(pVM, -2, &text);
sq_getbool(pVM, -1, &sbRelative);
// Get our GUI instance
CGUI * pGUI = g_pClient->GetGUI();
if(sbRelative != 0)
{
x *= pGUI->GetDisplayWidth();
y *= pGUI->GetDisplayHeight();
}
pGUI->DrawText(text, CEGUI::Vector2( x, y ), (CEGUI::colour)D3DCOLOR_RGBA(255, 255, 255, 255), pFont, true, true);
sq_pushbool(pVM, true);
return 1;
}
示例2: DrawText
void CDebugView::DrawText(String strText, DWORD dwColor)
{
// Get our GUI
CGUI * pGUI = g_pClient->GetGUI();
// Get the font
CEGUI::Font * pFont = pGUI->GetFont("tahoma", 10);
// Draw the text
pGUI->DrawText(strText, CEGUI::Vector2((float)pGUI->GetDisplayWidth()-400.0f, m_fDebugTextTop), CEGUI::colour(dwColor), pFont);
// Increment the text top
m_fDebugTextTop += 14.0f;
}
示例3: Draw
void CChatWindow::Draw()
{
// Get our GUI
CGUI * pGUI = g_pClient->GetGUI();
// Are we enabled and do we have a valid GUI instance?
if(m_bEnabled && pGUI)
{
// Draw the chat background
g_pClient->GetGraphics()->DrawRect(5, 5, 500, 30 + MAX_DISPLAYED_MESSAGES * 20, m_ulBackgroundColor);
// Do we have a valid font?
if(m_pFont)
{
int iCurrentMessage = (m_iCurrentPage * MAX_DISPLAYED_MESSAGES) - 1;
float fY = 30;
for(int x = 0; x < MAX_DISPLAYED_MESSAGES; x++)
{
// Draw the text
if(m_chatMessages[iCurrentMessage - x].fNameExtent)
{
// Draw a name shadow
pGUI->DrawText(m_chatMessages[iCurrentMessage - x].szName, CEGUI::Vector2(26.0f, fY + 1), MESSAGE_BACKGROUND_COLOR, m_pFont, m_chatMessages[iCurrentMessage - x].bAllowFormatting, false);
// Draw the name
pGUI->DrawText(m_chatMessages[iCurrentMessage - x].szName, CEGUI::Vector2(25.0f, fY), m_chatMessages[iCurrentMessage - x].nameColor, m_pFont, m_chatMessages[iCurrentMessage - x].bAllowFormatting);
// Draw a text shadow
pGUI->DrawText(m_chatMessages[iCurrentMessage - x].szMessage, CEGUI::Vector2(26.0f + m_chatMessages[iCurrentMessage - x].fNameExtent, fY + 1), MESSAGE_BACKGROUND_COLOR, m_pFont, m_chatMessages[iCurrentMessage - x].bAllowFormatting);
// Draw the text
pGUI->DrawText(m_chatMessages[iCurrentMessage - x].szMessage, CEGUI::Vector2(25.0f + m_chatMessages[iCurrentMessage - x].fNameExtent, fY), m_chatMessages[iCurrentMessage - x].messageColor, m_pFont, m_chatMessages[iCurrentMessage - x].bAllowFormatting);
}
else
{
// Draw a shadow
pGUI->DrawText(m_chatMessages[iCurrentMessage - x].szMessage, CEGUI::Vector2(26.0f, fY + 1), MESSAGE_BACKGROUND_COLOR, m_pFont, m_chatMessages[iCurrentMessage - x].bAllowFormatting, false);
// Draw the text
pGUI->DrawText(m_chatMessages[iCurrentMessage - x].szMessage, CEGUI::Vector2(25.0f, fY), m_chatMessages[iCurrentMessage - x].messageColor, m_pFont, m_chatMessages[iCurrentMessage - x].bAllowFormatting);
}
fY += 20;
}
}
}
}