mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix incorrect text wrapping in ingame server info
The maximum width for the server info and game info text was too small, which previously didn't matter, because the manual newlines broke text wrapping in this case, but with the fix from #6353 this now causes the text to break after the colons already. This is fixed by using the maximum available width for the text instead of a too small magic number (`250.0f`). For completeness, the maximum width for the title texts is unset (`-1.0f`), because they should never wrap, which is consistent with the MOTD title text.
This commit is contained in:
parent
55a39e1f08
commit
ffa4801220
|
@ -392,7 +392,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
||||||
x = 5.0f;
|
x = 5.0f;
|
||||||
y = 0.0f;
|
y = 0.0f;
|
||||||
|
|
||||||
TextRender()->Text(ServerInfo.x + x, ServerInfo.y + y, 32, Localize("Server info"), 250.0f);
|
TextRender()->Text(ServerInfo.x + x, ServerInfo.y + y, 32, Localize("Server info"), -1.0f);
|
||||||
y += 32.0f + 5.0f;
|
y += 32.0f + 5.0f;
|
||||||
|
|
||||||
mem_zero(aBuf, sizeof(aBuf));
|
mem_zero(aBuf, sizeof(aBuf));
|
||||||
|
@ -410,7 +410,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
||||||
Localize("Version"), CurrentServerInfo.m_aVersion,
|
Localize("Version"), CurrentServerInfo.m_aVersion,
|
||||||
Localize("Password"), CurrentServerInfo.m_Flags & 1 ? Localize("Yes") : Localize("No"));
|
Localize("Password"), CurrentServerInfo.m_Flags & 1 ? Localize("Yes") : Localize("No"));
|
||||||
|
|
||||||
TextRender()->Text(ServerInfo.x + x, ServerInfo.y + y, 20, aBuf, 250.0f);
|
TextRender()->Text(ServerInfo.x + x, ServerInfo.y + y, 20, aBuf, ServerInfo.w - 10.0f);
|
||||||
|
|
||||||
// copy info button
|
// copy info button
|
||||||
{
|
{
|
||||||
|
@ -451,7 +451,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
||||||
x = 5.0f;
|
x = 5.0f;
|
||||||
y = 0.0f;
|
y = 0.0f;
|
||||||
|
|
||||||
TextRender()->Text(GameInfo.x + x, GameInfo.y + y, 32, Localize("Game info"), 250.0f);
|
TextRender()->Text(GameInfo.x + x, GameInfo.y + y, 32, Localize("Game info"), -1.0f);
|
||||||
y += 32.0f + 5.0f;
|
y += 32.0f + 5.0f;
|
||||||
|
|
||||||
if(m_pClient->m_Snap.m_pGameInfoObj)
|
if(m_pClient->m_Snap.m_pGameInfoObj)
|
||||||
|
@ -472,7 +472,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
||||||
Localize("Score limit"), m_pClient->m_Snap.m_pGameInfoObj->m_ScoreLimit,
|
Localize("Score limit"), m_pClient->m_Snap.m_pGameInfoObj->m_ScoreLimit,
|
||||||
Localize("Time limit"), m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit,
|
Localize("Time limit"), m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit,
|
||||||
Localize("Players"), m_pClient->m_Snap.m_NumPlayers, CurrentServerInfo.m_MaxClients);
|
Localize("Players"), m_pClient->m_Snap.m_NumPlayers, CurrentServerInfo.m_MaxClients);
|
||||||
TextRender()->Text(GameInfo.x + x, GameInfo.y + y, 20, aBuf, 250.0f);
|
TextRender()->Text(GameInfo.x + x, GameInfo.y + y, 20, aBuf, GameInfo.w - 10.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// motd
|
// motd
|
||||||
|
|
Loading…
Reference in a new issue