Fixed issue #115, text now fits into columns in server browser

This commit is contained in:
xalduin 2010-06-10 06:40:22 +08:00 committed by Magnus Auvinen
parent dc3feaf42c
commit 6e1eaa96ec
2 changed files with 11 additions and 3 deletions

View file

@ -681,7 +681,7 @@ public:
Advance = pChr->m_AdvanceX + Kerning(pFont, Character, Nextcharacter)/Size;
}
if(pCursor->m_Flags&TEXTFLAG_STOP_AT_END && DrawX+Advance*Size-pCursor->m_StartX > pCursor->m_LineWidth)
if(pCursor->m_Flags&TEXTFLAG_STOP_AT_END && DrawX+(Advance+pChr->m_Width)*Size-pCursor->m_StartX > pCursor->m_LineWidth)
{
// we hit the end of the line, no more to render or count
pCurrent = pEnd;

View file

@ -309,7 +309,12 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
TextRender()->TextEx(&Cursor, pItem->m_aName, -1);
}
else if(Id == COL_MAP)
UI()->DoLabel(&Button, pItem->m_aMap, 12.0f, -1);
{
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
TextRender()->TextEx(&Cursor, pItem->m_aMap, -1);
}
else if(Id == COL_PLAYERS)
{
str_format(aTemp, sizeof(aTemp), "%i/%i", pItem->m_NumPlayers, pItem->m_MaxPlayers);
@ -332,7 +337,10 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
}
else if(Id == COL_GAMETYPE)
{
UI()->DoLabel(&Button, pItem->m_aGameType, 12.0f, 0);
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
TextRender()->TextEx(&Cursor, pItem->m_aGameType, -1);
}
}