Exemplo n.º 1
0
_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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
			}
		}
	}
}