mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix top alignment of some popup messages
The popup message has to be top- and not middle-aligned in some popups: - First launch - Existing player for nickname - Warning Likely a regression introduced by #6511.
This commit is contained in:
parent
7b93e41d81
commit
7af1fe3b52
|
@ -1131,7 +1131,7 @@ int CMenus::Render()
|
||||||
const char *pTitle = "";
|
const char *pTitle = "";
|
||||||
const char *pExtraText = "";
|
const char *pExtraText = "";
|
||||||
const char *pButtonText = "";
|
const char *pButtonText = "";
|
||||||
int ExtraAlign = 0;
|
bool TopAlign = false;
|
||||||
bool UseIpLabel = false;
|
bool UseIpLabel = false;
|
||||||
|
|
||||||
ColorRGBA BgColor = ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f);
|
ColorRGBA BgColor = ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f);
|
||||||
|
@ -1209,7 +1209,6 @@ int CMenus::Render()
|
||||||
pExtraText = aBuf;
|
pExtraText = aBuf;
|
||||||
pButtonText = Localize("Abort");
|
pButtonText = Localize("Abort");
|
||||||
}
|
}
|
||||||
ExtraAlign = 0;
|
|
||||||
}
|
}
|
||||||
else if(m_Popup == POPUP_RENAME_DEMO)
|
else if(m_Popup == POPUP_RENAME_DEMO)
|
||||||
{
|
{
|
||||||
|
@ -1241,7 +1240,7 @@ int CMenus::Render()
|
||||||
Localize("Please enter your nickname below."));
|
Localize("Please enter your nickname below."));
|
||||||
pExtraText = aBuf;
|
pExtraText = aBuf;
|
||||||
pButtonText = Localize("Ok");
|
pButtonText = Localize("Ok");
|
||||||
ExtraAlign = -1;
|
TopAlign = true;
|
||||||
}
|
}
|
||||||
else if(m_Popup == POPUP_POINTS)
|
else if(m_Popup == POPUP_POINTS)
|
||||||
{
|
{
|
||||||
|
@ -1250,7 +1249,7 @@ int CMenus::Render()
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("Your nickname '%s' is already used (%d points). Do you still want to use it?"), Client()->PlayerName(), Client()->m_Points);
|
str_format(aBuf, sizeof(aBuf), Localize("Your nickname '%s' is already used (%d points). Do you still want to use it?"), Client()->PlayerName(), Client()->m_Points);
|
||||||
pExtraText = aBuf;
|
pExtraText = aBuf;
|
||||||
ExtraAlign = -1;
|
TopAlign = true;
|
||||||
}
|
}
|
||||||
else if(Client()->m_Points >= 0)
|
else if(Client()->m_Points >= 0)
|
||||||
{
|
{
|
||||||
|
@ -1267,7 +1266,7 @@ int CMenus::Render()
|
||||||
pTitle = m_aMessageTopic;
|
pTitle = m_aMessageTopic;
|
||||||
pExtraText = m_aMessageBody;
|
pExtraText = m_aMessageBody;
|
||||||
pButtonText = m_aMessageButton;
|
pButtonText = m_aMessageButton;
|
||||||
ExtraAlign = -1;
|
TopAlign = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CUIRect Box, Part;
|
CUIRect Box, Part;
|
||||||
|
@ -1303,15 +1302,12 @@ int CMenus::Render()
|
||||||
}
|
}
|
||||||
|
|
||||||
Props.m_MaxWidth = (int)Part.w;
|
Props.m_MaxWidth = (int)Part.w;
|
||||||
if(ExtraAlign == -1)
|
if(TopAlign)
|
||||||
UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_ML, Props);
|
UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_TL, Props);
|
||||||
else
|
else if(TextRender()->TextWidth(FontSize, pExtraText, -1, -1.0f) > Part.w)
|
||||||
{
|
|
||||||
if(TextRender()->TextWidth(FontSize, pExtraText, -1, -1.0f) > Part.w)
|
|
||||||
UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_ML, Props);
|
UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_ML, Props);
|
||||||
else
|
else
|
||||||
UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_MC);
|
UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_MC);
|
||||||
}
|
|
||||||
|
|
||||||
if(m_Popup == POPUP_MESSAGE || m_Popup == POPUP_CONFIRM)
|
if(m_Popup == POPUP_MESSAGE || m_Popup == POPUP_CONFIRM)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue