mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Fixed issue #115, text now fits into columns in server browser
This commit is contained in:
parent
dc3feaf42c
commit
6e1eaa96ec
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue