Use ETextAlignment enum for UI

Replaces the magic numbers -1/0/1 for left/center/right

Based on the work done in upstream:

@cinaera added alignment enums
	04ee8b20a1

@TsFreddie renamed them
	67651e8122
This commit is contained in:
ChillerDragon 2022-01-21 16:20:15 +01:00
parent aaea2636c0
commit b770bc6988
16 changed files with 254 additions and 241 deletions

View file

@ -15,6 +15,13 @@ enum
TEXTFLAG_STOP_AT_END = 4
};
enum ETextAlignment
{
TEXTALIGN_LEFT = 1 << 0,
TEXTALIGN_CENTER = 1 << 1,
TEXTALIGN_RIGHT = 1 << 2,
};
enum ETextRenderFlags
{
TEXT_RENDER_FLAG_NO_X_BEARING = 1 << 0,

View file

@ -647,11 +647,11 @@ void CHud::RenderVoting()
str_format(aBuf, sizeof(aBuf), "%s - %s", aKey, Localize("Vote yes"));
Base.y += Base.h;
Base.h = 11.f;
UI()->DoLabel(&Base, aBuf, 6.0f, -1);
UI()->DoLabel(&Base, aBuf, 6.0f, TEXTALIGN_LEFT);
m_pClient->m_Binds.GetKey("vote no", aKey, sizeof(aKey));
str_format(aBuf, sizeof(aBuf), "%s - %s", Localize("Vote no"), aKey);
UI()->DoLabel(&Base, aBuf, 6.0f, 1);
UI()->DoLabel(&Base, aBuf, 6.0f, TEXTALIGN_RIGHT);
}
void CHud::RenderCursor()

View file

@ -213,7 +213,7 @@ int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const
Text.HMargin(pRect->h >= 20.0f ? 2.0f : 1.0f, &Text);
Text.HMargin((Text.h * FontFactor) / 2.0f, &Text);
UI()->DoLabel(&Text, pText, Text.h * CUI::ms_FontmodHeight, 0, -1, AlignVertically);
UI()->DoLabel(&Text, pText, Text.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, -1, AlignVertically);
if(MouseInsideColorPicker)
return 0;
@ -226,7 +226,7 @@ void CMenus::DoButton_KeySelect(const void *pID, const char *pText, int Checked,
RenderTools()->DrawUIRect(pRect, ColorRGBA(1, 1, 1, 0.5f * UI()->ButtonColorMul(pID)), CUI::CORNER_ALL, 5.0f);
CUIRect Temp;
pRect->HMargin(1.0f, &Temp);
UI()->DoLabel(&Temp, pText, Temp.h * CUI::ms_FontmodHeight, 0);
UI()->DoLabel(&Temp, pText, Temp.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER);
}
int CMenus::DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners, SUIAnimator *pAnimator, const ColorRGBA *pDefaultColor, const ColorRGBA *pActiveColor, const ColorRGBA *pHoverColor, float EdgeRounding, int AlignVertically)
@ -305,7 +305,7 @@ int CMenus::DoButton_MenuTab(const void *pID, const char *pText, int Checked, co
}
Rect.HMargin(2.0f, &Temp);
UI()->DoLabel(&Temp, pText, Temp.h * CUI::ms_FontmodHeight, 0, -1, AlignVertically);
UI()->DoLabel(&Temp, pText, Temp.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, -1, AlignVertically);
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
}
@ -318,7 +318,7 @@ int CMenus::DoButton_GridHeader(const void *pID, const char *pText, int Checked,
RenderTools()->DrawUIRect(pRect, ColorRGBA(1, 1, 1, 0.5f), CUI::CORNER_T, 5.0f);
CUIRect t;
pRect->VSplitLeft(5.0f, 0, &t);
UI()->DoLabel(&t, pText, pRect->h * CUI::ms_FontmodHeight, -1);
UI()->DoLabel(&t, pText, pRect->h * CUI::ms_FontmodHeight, TEXTALIGN_LEFT);
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
}
@ -339,13 +339,13 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c
{
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT);
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
UI()->DoLabel(&c, "\xEE\x97\x8D", c.h * CUI::ms_FontmodHeight, 0, -1, 0);
UI()->DoLabel(&c, "\xEE\x97\x8D", c.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, -1, 0);
TextRender()->SetCurFont(NULL);
}
else
UI()->DoLabel(&c, pBoxText, c.h * CUI::ms_FontmodHeight, 0, -1, 0);
UI()->DoLabel(&c, pBoxText, c.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, -1, 0);
TextRender()->SetRenderFlags(0);
UI()->DoLabel(&t, pText, c.h * CUI::ms_FontmodHeight, -1);
UI()->DoLabel(&t, pText, c.h * CUI::ms_FontmodHeight, TEXTALIGN_LEFT);
return UI()->DoButtonLogic(pID, pText, 0, pRect);
}
@ -424,7 +424,7 @@ ColorHSLA CMenus::DoLine_ColorPicker(int *pResetID, const float LineSize, const
float LabelWidth = TextRender()->TextWidth(0, 14.0f, pText, -1, -1.0f);
Section.VSplitLeft(LabelWidth, &Label, &Section);
UI()->DoLabelScaled(&Label, pText, LabelSize, -1);
UI()->DoLabelScaled(&Label, pText, LabelSize, TEXTALIGN_LEFT);
float Cut = WantedPickerPosition - (SectionWidth - Section.w);
if(Cut < 5)
@ -589,7 +589,7 @@ int CMenus::DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool
str_format(aBuf, sizeof(aBuf), "%d", Current);
}
RenderTools()->DrawUIRect(pRect, *Color, CUI::CORNER_ALL, Round);
UI()->DoLabel(pRect, aBuf, 10, 0, -1);
UI()->DoLabel(pRect, aBuf, 10, TEXTALIGN_CENTER, -1);
}
return Current;
@ -964,7 +964,7 @@ void CMenus::RenderLoading()
r.y = y + 20;
r.w = w;
r.h = h - 130;
UI()->DoLabel(&r, pCaption, 48.0f, 0, -1);
UI()->DoLabel(&r, pCaption, 48.0f, TEXTALIGN_CENTER, -1);
Graphics()->TextureClear();
Graphics()->QuadsBegin();
@ -995,12 +995,12 @@ void CMenus::RenderNews(CUIRect MainView)
{
MainView.HSplitTop(30.0f, &Label, &MainView);
aLine[Len - 1] = '\0';
UI()->DoLabelScaled(&Label, aLine + 1, 20.0f, -1);
UI()->DoLabelScaled(&Label, aLine + 1, 20.0f, TEXTALIGN_LEFT);
}
else
{
MainView.HSplitTop(20.0f, &Label, &MainView);
UI()->DoLabelScaled(&Label, aLine, 15.f, -1, -1);
UI()->DoLabelScaled(&Label, aLine, 15.f, TEXTALIGN_LEFT, -1);
}
}
}
@ -1220,7 +1220,7 @@ void CMenus::RenderColorPicker()
// TODO : ALPHA SUPPORT
//static int ALPHAID = 0;
UI()->DoLabel(&ALPHARect, "A: 255", 10, 0, -1);
UI()->DoLabel(&ALPHARect, "A: 255", 10, TEXTALIGN_CENTER, -1);
RenderTools()->DrawUIRect(&ALPHARect, ColorRGBA(0, 0, 0, 0.65f), CUI::CORNER_ALL, 5.0f);
// Logic
@ -1597,9 +1597,9 @@ int CMenus::Render()
Box.HSplitTop(24.f / UI()->Scale(), &Part, &Box);
Part.VMargin(20.f / UI()->Scale(), &Part);
if(TextRender()->TextWidth(0, 24.f, pTitle, -1, -1.0f) > Part.w)
UI()->DoLabelScaled(&Part, pTitle, 24.f, -1, (int)Part.w);
UI()->DoLabelScaled(&Part, pTitle, 24.f, TEXTALIGN_LEFT, (int)Part.w);
else
UI()->DoLabelScaled(&Part, pTitle, 24.f, 0);
UI()->DoLabelScaled(&Part, pTitle, 24.f, TEXTALIGN_CENTER);
Box.HSplitTop(20.f / UI()->Scale(), &Part, &Box);
Box.HSplitTop(24.f / UI()->Scale(), &Part, &Box);
Part.VMargin(20.f / UI()->Scale(), &Part);
@ -1607,13 +1607,13 @@ int CMenus::Render()
float FontSize = m_Popup == POPUP_FIRST_LAUNCH ? 16.0f : 20.f;
if(ExtraAlign == -1)
UI()->DoLabelScaled(&Part, pExtraText, FontSize, -1, (int)Part.w);
UI()->DoLabelScaled(&Part, pExtraText, FontSize, TEXTALIGN_LEFT, (int)Part.w);
else
{
if(TextRender()->TextWidth(0, FontSize, pExtraText, -1, -1.0f) > Part.w)
UI()->DoLabelScaled(&Part, pExtraText, FontSize, -1, (int)Part.w);
UI()->DoLabelScaled(&Part, pExtraText, FontSize, TEXTALIGN_LEFT, (int)Part.w);
else
UI()->DoLabelScaled(&Part, pExtraText, FontSize, 0, -1);
UI()->DoLabelScaled(&Part, pExtraText, FontSize, TEXTALIGN_CENTER, -1);
}
if(m_Popup == POPUP_QUIT)
@ -1628,7 +1628,7 @@ int CMenus::Render()
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%s\n%s", Localize("There's an unsaved map in the editor, you might want to save it before you quit the game."), Localize("Quit anyway?"));
UI()->DoLabelScaled(&Box, aBuf, 20.f, -1, Part.w - 20.0f);
UI()->DoLabelScaled(&Box, aBuf, 20.f, TEXTALIGN_LEFT, Part.w - 20.0f);
}
// buttons
@ -1722,7 +1722,7 @@ int CMenus::Render()
Label.VSplitLeft(100.0f, 0, &TextBox);
TextBox.VSplitLeft(20.0f, 0, &TextBox);
TextBox.VSplitRight(60.0f, &TextBox, 0);
UI()->DoLabel(&Label, Localize("Password"), 18.0f, -1);
UI()->DoLabel(&Label, Localize("Password"), 18.0f, TEXTALIGN_LEFT);
static float s_Offset = 0.0f;
UIEx()->DoEditBox(&g_Config.m_Password, &TextBox, g_Config.m_Password, sizeof(g_Config.m_Password), 12.0f, &s_Offset, true);
}
@ -1767,7 +1767,7 @@ int CMenus::Render()
Box.HSplitTop(64.f, 0, &Box);
Box.HSplitTop(24.f, &Part, &Box);
str_format(aBuf, sizeof(aBuf), "%d/%d KiB (%.1f KiB/s)", Client()->MapDownloadAmount() / 1024, Client()->MapDownloadTotalsize() / 1024, m_DownloadSpeed / 1024.0f);
UI()->DoLabel(&Part, aBuf, 20.f, 0, -1);
UI()->DoLabel(&Part, aBuf, 20.f, TEXTALIGN_CENTER, -1);
// time left
int TimeLeft = maximum(1, m_DownloadSpeed > 0.0f ? static_cast<int>((Client()->MapDownloadTotalsize() - Client()->MapDownloadAmount()) / m_DownloadSpeed) : 1);
@ -1782,7 +1782,7 @@ int CMenus::Render()
}
Box.HSplitTop(20.f, 0, &Box);
Box.HSplitTop(24.f, &Part, &Box);
UI()->DoLabel(&Part, aBuf, 20.f, 0, -1);
UI()->DoLabel(&Part, aBuf, 20.f, TEXTALIGN_CENTER, -1);
// progress bar
Box.HSplitTop(20.f, 0, &Box);
@ -1845,7 +1845,7 @@ int CMenus::Render()
Item.m_Rect.x += (OldWidth - Item.m_Rect.w) / 2.0f;
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f);
m_pClient->m_CountryFlags.Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, TEXTALIGN_CENTER);
}
}
@ -1953,7 +1953,7 @@ int CMenus::Render()
Label.VSplitLeft(120.0f, 0, &TextBox);
TextBox.VSplitLeft(20.0f, 0, &TextBox);
TextBox.VSplitRight(60.0f, &TextBox, 0);
UI()->DoLabel(&Label, Localize("New name:"), 18.0f, -1);
UI()->DoLabel(&Label, Localize("New name:"), 18.0f, TEXTALIGN_LEFT);
static float s_Offset = 0.0f;
UIEx()->DoEditBox(&s_Offset, &TextBox, m_aCurrentDemoFile, sizeof(m_aCurrentDemoFile), 12.0f, &s_Offset);
}
@ -2054,7 +2054,7 @@ int CMenus::Render()
Part.VSplitLeft(8.0f, 0, &Part);
char aBuffer[64];
str_format(aBuffer, sizeof(aBuffer), "%s: ×%g", Localize("Speed"), g_aSpeeds[m_Speed]);
UI()->DoLabel(&Part, aBuffer, 12.8f, -1);
UI()->DoLabel(&Part, aBuffer, 12.8f, TEXTALIGN_LEFT);
if(IncDemoSpeed)
m_Speed = clamp(m_Speed + 1, 0, (int)(sizeof(g_aSpeeds) / sizeof(g_aSpeeds[0]) - 1));
@ -2077,7 +2077,7 @@ int CMenus::Render()
Label.VSplitLeft(120.0f, 0, &TextBox);
TextBox.VSplitLeft(20.0f, 0, &TextBox);
TextBox.VSplitRight(60.0f, &TextBox, 0);
UI()->DoLabel(&Label, Localize("Video name:"), 18.0f, -1);
UI()->DoLabel(&Label, Localize("Video name:"), 18.0f, TEXTALIGN_LEFT);
static float s_Offset = 0.0f;
UIEx()->DoEditBox(&s_Offset, &TextBox, m_aCurrentDemoFile, sizeof(m_aCurrentDemoFile), 12.0f, &s_Offset);
}
@ -2184,7 +2184,7 @@ int CMenus::Render()
Label.VSplitLeft(100.0f, 0, &TextBox);
TextBox.VSplitLeft(20.0f, 0, &TextBox);
TextBox.VSplitRight(60.0f, &TextBox, 0);
UI()->DoLabel(&Label, Localize("Nickname"), 16.0f, -1);
UI()->DoLabel(&Label, Localize("Nickname"), 16.0f, TEXTALIGN_LEFT);
static float s_Offset = 0.0f;
UIEx()->DoEditBox(&g_Config.m_PlayerName, &TextBox, g_Config.m_PlayerName, sizeof(g_Config.m_PlayerName), 12.0f, &s_Offset, false, CUI::CORNER_ALL, Client()->PlayerName());
}
@ -2325,7 +2325,7 @@ void CMenus::RenderThemeSelection(CUIRect MainView, bool Header)
else // generic
str_format(aName, sizeof(aName), "%s", Theme.m_Name.cstr());
UI()->DoLabel(&Item.m_Rect, aName, 16 * CUI::ms_FontmodHeight, -1);
UI()->DoLabel(&Item.m_Rect, aName, 16 * CUI::ms_FontmodHeight, TEXTALIGN_LEFT);
}
bool ItemActive = false;
@ -2665,7 +2665,7 @@ void CMenus::RenderUpdating(const char *pCaption, int current, int total)
r.y = y + 20;
r.w = w;
r.h = h;
UI()->DoLabel(&r, Localize(pCaption), 32.0f, 0, -1);
UI()->DoLabel(&r, Localize(pCaption), 32.0f, TEXTALIGN_CENTER, -1);
if(total > 0)
{

View file

@ -165,7 +165,7 @@ class CMenus : public CComponent
if(pText == NULL)
pText = GetTextLambda();
NewRect.m_Text = pText;
UI()->DoLabel(NewRect, &Text, pText, Text.h * CUI::ms_FontmodHeight, 0, -1, AlignVertically);
UI()->DoLabel(NewRect, &Text, pText, Text.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, -1, AlignVertically);
}
}
Graphics()->SetColor(1, 1, 1, 1);

View file

@ -181,11 +181,11 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
CUIRect MsgBox = View;
if(!ServerBrowser()->NumServers() && ServerBrowser()->IsGettingServerlist())
UI()->DoLabelScaled(&MsgBox, Localize("Getting server list from master server"), 16.0f, 0);
UI()->DoLabelScaled(&MsgBox, Localize("Getting server list from master server"), 16.0f, TEXTALIGN_CENTER);
else if(!ServerBrowser()->NumServers())
UI()->DoLabelScaled(&MsgBox, Localize("No servers found"), 16.0f, 0);
UI()->DoLabelScaled(&MsgBox, Localize("No servers found"), 16.0f, TEXTALIGN_CENTER);
else if(ServerBrowser()->NumServers() && !NumServers)
UI()->DoLabelScaled(&MsgBox, Localize("No servers match your filter criteria"), 16.0f, 0);
UI()->DoLabelScaled(&MsgBox, Localize("No servers match your filter criteria"), 16.0f, TEXTALIGN_CENTER);
}
static float s_ScrollValue = 0;
@ -350,17 +350,17 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
const char *pStr = str_utf8_find_nocase(pItem->m_aName, g_Config.m_BrFilterString);
if(pStr)
{
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 0), &Button, pItem->m_aName, FontSize, -1, Button.w, 1, true, (int)(pStr - pItem->m_aName));
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 0), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)(pStr - pItem->m_aName));
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 1), &Button, pStr, FontSize, -1, Button.w, 1, true, (int)str_length(g_Config.m_BrFilterString), &pItem->m_pUIElement->Get(g_OffsetColName + 0)->m_Cursor);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 1), &Button, pStr, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)str_length(g_Config.m_BrFilterString), &pItem->m_pUIElement->Get(g_OffsetColName + 0)->m_Cursor);
TextRender()->TextColor(1, 1, 1, 1);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 2), &Button, pStr + str_length(g_Config.m_BrFilterString), FontSize, -1, Button.w, 1, true, -1, &pItem->m_pUIElement->Get(g_OffsetColName + 1)->m_Cursor);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 2), &Button, pStr + str_length(g_Config.m_BrFilterString), FontSize, TEXTALIGN_LEFT, Button.w, 1, true, -1, &pItem->m_pUIElement->Get(g_OffsetColName + 1)->m_Cursor);
}
else
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName), &Button, pItem->m_aName, FontSize, -1, Button.w, 1, true);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
}
else
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName), &Button, pItem->m_aName, FontSize, -1, Button.w, 1, true);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
}
else if(ID == COL_MAP)
{
@ -383,17 +383,17 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
const char *pStr = str_utf8_find_nocase(pItem->m_aMap, g_Config.m_BrFilterString);
if(pStr)
{
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 0), &Button, pItem->m_aMap, FontSize, -1, Button.w, 1, true, (int)(pStr - pItem->m_aMap));
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 0), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)(pStr - pItem->m_aMap));
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 1), &Button, pStr, FontSize, -1, Button.w, 1, true, (int)str_length(g_Config.m_BrFilterString), &pItem->m_pUIElement->Get(g_OffsetColMap + 0)->m_Cursor);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 1), &Button, pStr, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)str_length(g_Config.m_BrFilterString), &pItem->m_pUIElement->Get(g_OffsetColMap + 0)->m_Cursor);
TextRender()->TextColor(1, 1, 1, 1);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 2), &Button, pStr + str_length(g_Config.m_BrFilterString), FontSize, -1, Button.w, 1, true, -1, &pItem->m_pUIElement->Get(g_OffsetColMap + 1)->m_Cursor);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 2), &Button, pStr + str_length(g_Config.m_BrFilterString), FontSize, TEXTALIGN_LEFT, Button.w, 1, true, -1, &pItem->m_pUIElement->Get(g_OffsetColMap + 1)->m_Cursor);
}
else
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap), &Button, pItem->m_aMap, FontSize, -1, Button.w, 1, true);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
}
else
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap), &Button, pItem->m_aMap, FontSize, -1, Button.w, 1, true);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
}
else if(ID == COL_PLAYERS)
{
@ -410,7 +410,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit & IServerBrowser::QUICK_PLAYER))
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1);
float FontSize = 12.0f * UI()->Scale();
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColPlayers), &Button, aTemp, FontSize, 1, -1, 1, false);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColPlayers), &Button, aTemp, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
TextRender()->TextColor(1, 1, 1, 1);
}
else if(ID == COL_PING)
@ -424,14 +424,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
}
float FontSize = 12.0f * UI()->Scale();
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColPing), &Button, aTemp, FontSize, 1, -1, 1, false);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColPing), &Button, aTemp, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
}
else if(ID == COL_VERSION)
{
const char *pVersion = pItem->m_aVersion;
float FontSize = 12.0f * UI()->Scale();
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColVersion), &Button, pVersion, FontSize, 1, -1, 1, false);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColVersion), &Button, pVersion, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
}
else if(ID == COL_GAMETYPE)
{
@ -458,11 +458,11 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
ColorRGBA rgb = color_cast<ColorRGBA>(hsl);
TextRender()->TextColor(rgb);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColGameType), &Button, pItem->m_aGameType, FontSize, -1, Button.w, 1, true);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColGameType), &Button, pItem->m_aGameType, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
}
else
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColGameType), &Button, pItem->m_aGameType, FontSize, -1, Button.w, 1, true);
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColGameType), &Button, pItem->m_aGameType, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
}
}
}
@ -514,7 +514,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
{
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 16.0f, -1, -1, 0);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 16.0f, TEXTALIGN_LEFT, -1, 0);
SearchIconWidth = TextRender()->TextWidth(0, 16.0f, pSearchLabel, -1, -1.0f);
ExcludeIconWidth = TextRender()->TextWidth(0, 16.0f, pExcludeLabel, -1, -1.0f);
ExcludeSearchIconMax = maximum(SearchIconWidth, ExcludeIconWidth);
@ -525,7 +525,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
char aBufSearch[64];
str_format(aBufSearch, sizeof(aBufSearch), "%s:", Localize("Search"));
UI()->DoLabelScaled(&QuickSearch, aBufSearch, 14.0f, -1);
UI()->DoLabelScaled(&QuickSearch, aBufSearch, 14.0f, TEXTALIGN_LEFT);
QuickSearch.VSplitLeft(SearchExcludeAddrStrMax, 0, &QuickSearch);
QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
@ -541,7 +541,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
{
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
UI()->DoLabelScaled(&QuickExclude, pExcludeLabel, 16.0f, -1, -1, 0);
UI()->DoLabelScaled(&QuickExclude, pExcludeLabel, 16.0f, TEXTALIGN_LEFT, -1, 0);
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
QuickExclude.VSplitLeft(ExcludeSearchIconMax, 0, &QuickExclude);
@ -549,7 +549,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
char aBufExclude[64];
str_format(aBufExclude, sizeof(aBufExclude), "%s:", Localize("Exclude"));
UI()->DoLabelScaled(&QuickExclude, aBufExclude, 14.0f, -1);
UI()->DoLabelScaled(&QuickExclude, aBufExclude, 14.0f, TEXTALIGN_LEFT);
QuickExclude.VSplitLeft(SearchExcludeAddrStrMax, 0, &QuickExclude);
QuickExclude.VSplitLeft(5.0f, 0, &QuickExclude);
@ -576,9 +576,9 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
CUIRect SvrsOnline, PlysOnline;
Status3.HSplitTop(20.f, &PlysOnline, &SvrsOnline);
PlysOnline.VSplitRight(TextRender()->TextWidth(0, 12.0f, aBufPyr, -1, -1.0f), 0, &PlysOnline);
UI()->DoLabelScaled(&PlysOnline, aBufPyr, 12.0f, -1);
UI()->DoLabelScaled(&PlysOnline, aBufPyr, 12.0f, TEXTALIGN_LEFT);
SvrsOnline.VSplitRight(TextRender()->TextWidth(0, 12.0f, aBufSvr, -1, -1.0f), 0, &SvrsOnline);
UI()->DoLabelScaled(&SvrsOnline, aBufSvr, 12.0f, -1);
UI()->DoLabelScaled(&SvrsOnline, aBufSvr, 12.0f, TEXTALIGN_LEFT);
// status box
{
@ -587,7 +587,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
ServerAddr.Margin(2.0f, &ServerAddr);
// address info
UI()->DoLabelScaled(&ServerAddr, Localize("Server address:"), 14.0f, -1);
UI()->DoLabelScaled(&ServerAddr, Localize("Server address:"), 14.0f, TEXTALIGN_LEFT);
ServerAddr.VSplitLeft(SearchExcludeAddrStrMax + 5.0f + ExcludeSearchIconMax + 5.0f, NULL, &ServerAddr);
static int s_ClearButton = 0;
static float s_Offset = 0.0f;
@ -664,7 +664,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
RenderTools()->DrawUIRect(&FilterHeader, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_T, 4.0f);
RenderTools()->DrawUIRect(&ServerFilter, ColorRGBA(0, 0, 0, 0.15f), CUI::CORNER_B, 4.0f);
UI()->DoLabelScaled(&FilterHeader, Localize("Server filter"), FontSize + 2.0f, 0);
UI()->DoLabelScaled(&FilterHeader, Localize("Server filter"), FontSize + 2.0f, TEXTALIGN_CENTER);
CUIRect Button, Button2;
ServerFilter.VSplitLeft(5.0f, 0, &ServerFilter);
@ -698,7 +698,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
ServerFilter.HSplitTop(5.0f, 0, &ServerFilter);
ServerFilter.HSplitTop(19.0f, &Button, &ServerFilter);
UI()->DoLabelScaled(&Button, Localize("Game types:"), FontSize, -1);
UI()->DoLabelScaled(&Button, Localize("Game types:"), FontSize, TEXTALIGN_LEFT);
Button.VSplitRight(60.0f, 0, &Button);
ServerFilter.HSplitTop(3.0f, 0, &ServerFilter);
static float s_OffsetGametype = 0.0f;
@ -708,7 +708,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
// server address
ServerFilter.HSplitTop(3.0f, 0, &ServerFilter);
ServerFilter.HSplitTop(19.0f, &Button, &ServerFilter);
UI()->DoLabelScaled(&Button, Localize("Server address:"), FontSize, -1);
UI()->DoLabelScaled(&Button, Localize("Server address:"), FontSize, TEXTALIGN_LEFT);
Button.VSplitRight(60.0f, 0, &Button);
static float s_OffsetAddr = 0.0f;
if(UIEx()->DoEditBox(&g_Config.m_BrFilterServerAddress, &Button, g_Config.m_BrFilterServerAddress, sizeof(g_Config.m_BrFilterServerAddress), FontSize, &s_OffsetAddr))
@ -886,7 +886,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
}
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Active ? 1.0f : 0.2f);
UI()->DoLabelScaled(&Rect, pName, FontSize, 0);
UI()->DoLabelScaled(&Rect, pName, FontSize, TEXTALIGN_CENTER);
TextRender()->TextColor(1.0, 1.0, 1.0, 1.0f);
}
}
@ -1030,7 +1030,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
ServerDetails.HSplitTop(ms_ListheaderHeight, &ServerHeader, &ServerDetails);
RenderTools()->DrawUIRect(&ServerHeader, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_T, 4.0f);
RenderTools()->DrawUIRect(&ServerDetails, ColorRGBA(0, 0, 0, 0.15f), CUI::CORNER_B, 4.0f);
UI()->DoLabelScaled(&ServerHeader, Localize("Server details"), FontSize + 2.0f, 0);
UI()->DoLabelScaled(&ServerHeader, Localize("Server details"), FontSize + 2.0f, TEXTALIGN_CENTER);
if(pSelectedServer)
{
@ -1087,7 +1087,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
for(auto &Label : s_aLabels)
{
LeftColumn.HSplitTop(15.0f, &Row, &LeftColumn);
UI()->DoLabelScaled(&Row, Localize(Label), FontSize, -1);
UI()->DoLabelScaled(&Row, Localize(Label), FontSize, TEXTALIGN_LEFT);
}
RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
@ -1253,7 +1253,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
ServerFriends.HSplitTop(ms_ListheaderHeight, &FilterHeader, &ServerFriends);
RenderTools()->DrawUIRect(&FilterHeader, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_T, 4.0f);
RenderTools()->DrawUIRect(&ServerFriends, ColorRGBA(0, 0, 0, 0.15f), 0, 4.0f);
UI()->DoLabelScaled(&FilterHeader, Localize("Friends"), FontSize + 4.0f, 0);
UI()->DoLabelScaled(&FilterHeader, Localize("Friends"), FontSize + 4.0f, TEXTALIGN_CENTER);
CUIRect Button, List;
ServerFriends.Margin(3.0f, &ServerFriends);
@ -1280,15 +1280,15 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
Item.m_Rect.VMargin(2.5f, &Item.m_Rect);
Item.m_Rect.HSplitTop(12.0f, &Item.m_Rect, &Button);
UI()->DoLabelScaled(&Item.m_Rect, m_lFriends[i].m_pFriendInfo->m_aName, FontSize, -1);
UI()->DoLabelScaled(&Button, m_lFriends[i].m_pFriendInfo->m_aClan, FontSize, -1);
UI()->DoLabelScaled(&Item.m_Rect, m_lFriends[i].m_pFriendInfo->m_aName, FontSize, TEXTALIGN_LEFT);
UI()->DoLabelScaled(&Button, m_lFriends[i].m_pFriendInfo->m_aClan, FontSize, TEXTALIGN_LEFT);
RenderTools()->DrawUIRect(&OnState, m_lFriends[i].m_NumFound ? ColorRGBA(0.0f, 1.0f, 0.0f, 0.25f) : ColorRGBA(1.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_R, 4.0f);
OnState.HMargin((OnState.h - FontSize) / 3, &OnState);
OnState.VMargin(5.0f, &OnState);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%i", m_lFriends[i].m_NumFound);
UI()->DoLabelScaled(&OnState, aBuf, FontSize + 2, 1);
UI()->DoLabelScaled(&OnState, aBuf, FontSize + 2, TEXTALIGN_RIGHT);
}
}
@ -1339,7 +1339,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
ServerFriends.HSplitTop(19.0f, &Button, &ServerFriends);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Name"));
UI()->DoLabelScaled(&Button, aBuf, FontSize + 2, -1);
UI()->DoLabelScaled(&Button, aBuf, FontSize + 2, TEXTALIGN_LEFT);
Button.VSplitLeft(80.0f, 0, &Button);
static char s_aName[MAX_NAME_LENGTH] = {0};
static float s_OffsetName = 0.0f;
@ -1348,7 +1348,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
ServerFriends.HSplitTop(3.0f, 0, &ServerFriends);
ServerFriends.HSplitTop(19.0f, &Button, &ServerFriends);
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Clan"));
UI()->DoLabelScaled(&Button, aBuf, FontSize + 2, -1);
UI()->DoLabelScaled(&Button, aBuf, FontSize + 2, TEXTALIGN_LEFT);
Button.VSplitLeft(80.0f, 0, &Button);
static char s_aClan[MAX_CLAN_LENGTH] = {0};
static float s_OffsetClan = 0.0f;

View file

@ -27,7 +27,7 @@
int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect)
{
RenderTools()->DrawUIRect(pRect, ColorRGBA(1, 1, 1, (Checked ? 0.10f : 0.5f) * UI()->ButtonColorMul(pID)), CUI::CORNER_ALL, 5.0f);
UI()->DoLabel(pRect, pText, 14.0f, 0);
UI()->DoLabel(pRect, pText, 14.0f, TEXTALIGN_CENTER);
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
}
@ -89,11 +89,11 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
Box.HSplitTop(20.f / UI()->Scale(), &Part, &Box);
Box.HSplitTop(24.f / UI()->Scale(), &Part, &Box);
UI()->DoLabelScaled(&Part, Localize("Select a name"), 24.f, 0);
UI()->DoLabelScaled(&Part, Localize("Select a name"), 24.f, TEXTALIGN_CENTER);
Box.HSplitTop(20.f / UI()->Scale(), &Part, &Box);
Box.HSplitTop(24.f / UI()->Scale(), &Part, &Box);
Part.VMargin(20.f / UI()->Scale(), &Part);
UI()->DoLabelScaled(&Part, m_aDemoPlayerPopupHint, 24.f, 0);
UI()->DoLabelScaled(&Part, m_aDemoPlayerPopupHint, 24.f, TEXTALIGN_CENTER);
CUIRect Label, TextBox, Ok, Abort;
@ -157,7 +157,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
Label.VSplitLeft(120.0f, 0, &TextBox);
TextBox.VSplitLeft(20.0f, 0, &TextBox);
TextBox.VSplitRight(60.0f, &TextBox, 0);
UI()->DoLabel(&Label, Localize("New name:"), 18.0f, -1);
UI()->DoLabel(&Label, Localize("New name:"), 18.0f, TEXTALIGN_LEFT);
static float s_Offset = 0.0f;
if(UIEx()->DoEditBox(&s_Offset, &TextBox, m_aCurrentDemoFile, sizeof(m_aCurrentDemoFile), 12.0f, &s_Offset))
{
@ -327,7 +327,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
char aTotalTime[32];
str_time((int64_t)TotalTicks / SERVER_TICK_SPEED * 100, TIME_HOURS, aTotalTime, sizeof(aTotalTime));
str_format(aBuffer, sizeof(aBuffer), "%s / %s", aCurrentTime, aTotalTime);
UI()->DoLabel(&SeekBar, aBuffer, SeekBar.h * 0.70f, 0);
UI()->DoLabel(&SeekBar, aBuffer, SeekBar.h * 0.70f, TEXTALIGN_CENTER);
// do the logic
int Inside = UI()->MouseInside(&SeekBar);
@ -434,7 +434,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
ButtonBar.VSplitLeft(Margins * 3, 0, &ButtonBar);
char aBuffer[64];
str_format(aBuffer, sizeof(aBuffer), "×%g", pInfo->m_Speed);
UI()->DoLabel(&ButtonBar, aBuffer, Button.h * 0.7f, -1);
UI()->DoLabel(&ButtonBar, aBuffer, Button.h * 0.7f, TEXTALIGN_LEFT);
// slice begin button
ButtonBar.VSplitLeft(Margins * 10, 0, &ButtonBar);
@ -903,76 +903,76 @@ void CMenus::RenderDemoList(CUIRect MainView)
// left side
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Created:"), 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Created:"), 14.0f, TEXTALIGN_LEFT);
char aTimestamp[256];
str_timestamp_ex(m_lDemos[m_DemolistSelectedIndex].m_Date, aTimestamp, sizeof(aTimestamp), FORMAT_SPACE);
UI()->DoLabelScaled(&Right, aTimestamp, 14.0f, -1);
UI()->DoLabelScaled(&Right, aTimestamp, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Type:"), 14.0f, -1);
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aType, 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Type:"), 14.0f, TEXTALIGN_LEFT);
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aType, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Length:"), 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Length:"), 14.0f, TEXTALIGN_LEFT);
int Length = m_lDemos[m_DemolistSelectedIndex].Length();
char aBuf[64];
str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf));
UI()->DoLabelScaled(&Right, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Version:"), 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Version:"), 14.0f, TEXTALIGN_LEFT);
str_format(aBuf, sizeof(aBuf), "%d", m_lDemos[m_DemolistSelectedIndex].m_Info.m_Version);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Markers:"), 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Markers:"), 14.0f, TEXTALIGN_LEFT);
str_format(aBuf, sizeof(aBuf), "%d", m_lDemos[m_DemolistSelectedIndex].NumMarkers());
UI()->DoLabelScaled(&Right, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
// right side
Labels = MainView;
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Map:"), 14.0f, -1);
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aMapName, 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Map:"), 14.0f, TEXTALIGN_LEFT);
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aMapName, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Size:"), 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Size:"), 14.0f, TEXTALIGN_LEFT);
const float Size = m_lDemos[m_DemolistSelectedIndex].Size() / 1024.0f;
if(Size > 1024)
str_format(aBuf, sizeof(aBuf), Localize("%.2f MiB"), Size / 1024.0f);
else
str_format(aBuf, sizeof(aBuf), Localize("%.2f KiB"), Size);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
if(m_lDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256 != SHA256_ZEROED)
{
UI()->DoLabelScaled(&Left, "SHA256:", 14.0f, -1);
UI()->DoLabelScaled(&Left, "SHA256:", 14.0f, TEXTALIGN_LEFT);
char aSha[SHA256_MAXSTRSIZE];
sha256_str(m_lDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256, aSha, sizeof(aSha) / 2);
UI()->DoLabelScaled(&Right, aSha, Right.w > 235 ? 14.0f : 11.0f, -1);
UI()->DoLabelScaled(&Right, aSha, Right.w > 235 ? 14.0f : 11.0f, TEXTALIGN_LEFT);
}
else
{
UI()->DoLabelScaled(&Left, Localize("Crc:"), 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Crc:"), 14.0f, TEXTALIGN_LEFT);
str_format(aBuf, sizeof(aBuf), "%08x", m_lDemos[m_DemolistSelectedIndex].m_MapInfo.m_Crc);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
}
Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Netversion:"), 14.0f, -1);
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aNetversion, 14.0f, -1);
UI()->DoLabelScaled(&Left, Localize("Netversion:"), 14.0f, TEXTALIGN_LEFT);
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aNetversion, 14.0f, TEXTALIGN_LEFT);
}
// demo list
@ -1171,7 +1171,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
char aBuf[3];
str_format(aBuf, sizeof(aBuf), "%d", r.front().NumMarkers());
Button.VMargin(4.0f, &Button);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, 1);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT);
}
else if(ID == COL_LENGTH && !r.front().m_IsDir && r.front().m_InfosLoaded)
{
@ -1179,14 +1179,14 @@ void CMenus::RenderDemoList(CUIRect MainView)
char aBuf[32];
str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf));
Button.VMargin(4.0f, &Button);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, 1);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT);
}
else if(ID == COL_DATE && !r.front().m_IsDir)
{
char aBuf[64];
str_timestamp_ex(r.front().m_Date, aBuf, sizeof(aBuf), FORMAT_SPACE);
Button.VSplitRight(24.0f, &Button, 0);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, 1);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT);
}
}
}
@ -1301,5 +1301,5 @@ void CMenus::RenderDemoList(CUIRect MainView)
#endif
}
UI()->DoLabelScaled(&LabelRect, aFooterLabel, 14.0f, -1);
UI()->DoLabelScaled(&LabelRect, aFooterLabel, 14.0f, TEXTALIGN_LEFT);
}

View file

@ -215,12 +215,12 @@ void CMenus::RenderPlayers(CUIRect MainView)
RenderTools()->DrawUIRect(&Options, ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f);
Options.Margin(10.0f, &Options);
Options.HSplitTop(50.0f, &Button, &Options);
UI()->DoLabelScaled(&Button, Localize("Player options"), 34.0f, -1);
UI()->DoLabelScaled(&Button, Localize("Player options"), 34.0f, TEXTALIGN_LEFT);
// headline
Options.HSplitTop(34.0f, &ButtonBar, &Options);
ButtonBar.VSplitRight(231.0f, &Player, &ButtonBar);
UI()->DoLabelScaled(&Player, Localize("Player"), 24.0f, -1);
UI()->DoLabelScaled(&Player, Localize("Player"), 24.0f, TEXTALIGN_LEFT);
ButtonBar.HMargin(1.0f, &ButtonBar);
float Width = ButtonBar.h * 2.0f;
@ -392,13 +392,13 @@ void CMenus::RenderPlayers(CUIRect MainView)
votearea.VSplitRight(50.0f, &votearea, &button);
char buf[256];
str_format(buf, sizeof(buf), "%d", gameclient.voting->seconds_left());
UI()->DoLabel(&button, buf, 24.0f, 0);
UI()->DoLabel(&button, buf, 24.0f, TEXTALIGN_CENTER);
// do description and command
votearea.VSplitLeft(5.0f, 0, &votearea);
UI()->DoLabel(&votearea, gameclient.voting->vote_description(), 14.0f, -1);
UI()->DoLabel(&votearea, gameclient.voting->vote_description(), 14.0f, TEXTALIGN_LEFT);
votearea.HSplitTop(16.0f, 0, &votearea);
UI()->DoLabel(&votearea, gameclient.voting->vote_command(), 10.0f, -1);
UI()->DoLabel(&votearea, gameclient.voting->vote_command(), 10.0f, TEXTALIGN_LEFT);
// do bars
bars.HSplitTop(10.0f, 0, &bars);
@ -409,7 +409,7 @@ void CMenus::RenderPlayers(CUIRect MainView)
}
else
{
UI()->DoLabel(&votearea, "No vote in progress", 18.0f, -1);
UI()->DoLabel(&votearea, "No vote in progress", 18.0f, TEXTALIGN_LEFT);
}*/
}
@ -553,7 +553,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
CListboxItem Item = UiDoListboxNextItem(pOption);
if(Item.m_Visible)
UI()->DoLabelScaled(&Item.m_Rect, pOption->m_aDescription, 13.0f, -1);
UI()->DoLabelScaled(&Item.m_Rect, pOption->m_aDescription, 13.0f, TEXTALIGN_LEFT);
if(NumVoteOptions < Total)
aIndices[NumVoteOptions] = i;
@ -611,7 +611,7 @@ bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_NORMAL, vec2(1.0f, 0.0f), TeeRenderPos);
Item.m_Rect.x += TeeInfo.m_Size;
UI()->DoLabelScaled(&Item.m_Rect, m_pClient->m_aClients[aPlayerIDs[i]].m_aName, 16.0f, -1);
UI()->DoLabelScaled(&Item.m_Rect, m_pClient->m_aClients[aPlayerIDs[i]].m_aName, 16.0f, TEXTALIGN_LEFT);
}
}
@ -676,7 +676,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
const char *pSearchLabel = "\xEE\xA2\xB6";
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1, -1, 0);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, -1, 0);
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f);
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
@ -730,7 +730,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
Bottom.VSplitRight(160.0f, &Bottom, &Reason);
Reason.HSplitTop(5.0f, 0, &Reason);
const char *pLabel = Localize("Reason:");
UI()->DoLabelScaled(&Reason, pLabel, 14.0f, -1);
UI()->DoLabelScaled(&Reason, pLabel, 14.0f, TEXTALIGN_LEFT);
float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1, -1.0f);
Reason.VSplitLeft(w + 10.0f, 0, &Reason);
static float s_Offset = 0.0f;
@ -789,10 +789,10 @@ void CMenus::RenderServerControl(CUIRect MainView)
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
Bottom.VSplitLeft(5.0f, 0, &Bottom);
Bottom.VSplitLeft(250.0f, &Button, &Bottom);
UI()->DoLabelScaled(&Button, Localize("Vote description:"), 14.0f, -1);
UI()->DoLabelScaled(&Button, Localize("Vote description:"), 14.0f, TEXTALIGN_LEFT);
Bottom.VSplitLeft(20.0f, 0, &Button);
UI()->DoLabelScaled(&Button, Localize("Vote command:"), 14.0f, -1);
UI()->DoLabelScaled(&Button, Localize("Vote command:"), 14.0f, TEXTALIGN_LEFT);
static char s_aVoteDescription[64] = {0};
static char s_aVoteCommand[512] = {0};

View file

@ -83,7 +83,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
{
// headline
Game.HSplitTop(20.0f, &Label, &Game);
UI()->DoLabelScaled(&Label, Localize("Game"), 20.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Game"), 20.0f, TEXTALIGN_LEFT);
Game.Margin(5.0f, &Game);
Game.VSplitMid(&Left, &Right);
Left.VSplitRight(5.0f, &Left, 0);
@ -160,7 +160,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
Right.HSplitTop(20.0f, &Label, &Right);
Right.HSplitTop(20.0f, &Button, &Right);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Name plates size"), g_Config.m_ClNameplatesSize);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
g_Config.m_ClNameplatesSize = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClNameplatesSize, &Button, g_Config.m_ClNameplatesSize / 100.0f) * 100.0f + 0.1f);
Right.HSplitTop(20.0f, &Button, &Right);
@ -178,7 +178,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
Right.HSplitTop(20.0f, &Label, &Right);
Right.HSplitTop(20.0f, &Button, &Right);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Clan plates size"), g_Config.m_ClNameplatesClanSize);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
g_Config.m_ClNameplatesClanSize = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClNameplatesClanSize, &Button, g_Config.m_ClNameplatesClanSize / 100.0f) * 100.0f + 0.1f);
}
}
@ -188,7 +188,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
{
// headline
Client.HSplitTop(20.0f, &Label, &Client);
UI()->DoLabelScaled(&Label, Localize("Client"), 20.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Client"), 20.0f, TEXTALIGN_LEFT);
Client.Margin(5.0f, &Client);
Client.VSplitMid(&Left, &Right);
Left.VSplitRight(5.0f, &Left, 0);
@ -215,7 +215,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max demos"), g_Config.m_ClAutoDemoMax);
else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max demos"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right);
g_Config.m_ClAutoDemoMax = static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoDemoMax, &Button, g_Config.m_ClAutoDemoMax / 1000.0f) * 1000.0f + 0.1f);
@ -229,7 +229,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoScreenshotMax);
else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right);
g_Config.m_ClAutoScreenshotMax = static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax / 1000.0f) * 1000.0f + 0.1f);
}
@ -241,7 +241,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i Hz", Localize("Refresh Rate"), g_Config.m_ClRefreshRate);
else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Refresh Rate"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Left.HSplitTop(20.0f, &Button, &Left);
g_Config.m_ClRefreshRate = static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClRefreshRate, &Button, g_Config.m_ClRefreshRate / 10000.0f) * 10000.0f + 0.1f);
@ -324,7 +324,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoStatboardScreenshotMax);
else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right);
g_Config.m_ClAutoStatboardScreenshotMax =
static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoStatboardScreenshotMax,
@ -350,7 +350,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max CSVs"), g_Config.m_ClAutoCSVMax);
else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max CSVs"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right);
g_Config.m_ClAutoCSVMax =
static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoCSVMax,
@ -394,7 +394,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Button.VSplitLeft(150.0f, &Button, 0);
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Name"));
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
static float s_OffsetName = 0.0f;
if(UIEx()->DoEditBox(pName, &Button, pName, sizeof(g_Config.m_PlayerName), 14.0f, &s_OffsetName, false, CUI::CORNER_ALL, pNameFallback))
{
@ -408,7 +408,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Button.VSplitLeft(200.0f, &Button, &Dummy);
Button.VSplitLeft(150.0f, &Button, 0);
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Clan"));
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
static float s_OffsetClan = 0.0f;
if(UIEx()->DoEditBox(pClan, &Button, pClan, sizeof(g_Config.m_PlayerClan), 14.0f, &s_OffsetClan))
{
@ -448,7 +448,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f);
m_pClient->m_CountryFlags.Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
if(pEntry->m_Texture.IsValid())
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, TEXTALIGN_CENTER);
}
}
@ -525,7 +525,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
SkinPrefix.VSplitLeft(120.0f, &SkinPrefix, 0);
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Your skin"));
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);
@ -557,7 +557,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
}
SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix);
UI()->DoLabelScaled(&SkinPrefixLabel, Localize("Skin prefix"), 14.0f, -1);
UI()->DoLabelScaled(&SkinPrefixLabel, Localize("Skin prefix"), 14.0f, TEXTALIGN_LEFT);
SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix);
{
@ -626,7 +626,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
for(int i = 0; i < 2; i++)
{
aRects[i].HSplitTop(20.0f, &Label, &aRects[i]);
UI()->DoLabelScaled(&Label, paParts[i], 14.0f, -1);
UI()->DoLabelScaled(&Label, paParts[i], 14.0f, TEXTALIGN_LEFT);
aRects[i].VSplitLeft(10.0f, 0, &aRects[i]);
aRects[i].HSplitTop(2.5f, 0, &aRects[i]);
@ -700,7 +700,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
Item.m_Rect.VSplitLeft(60.0f, 0, &Item.m_Rect);
str_format(aBuf, sizeof(aBuf), "%s", s->m_aName);
RenderTools()->UI()->DoLabelScaled(&Item.m_Rect, aBuf, 12.0f, -1, Item.m_Rect.w);
RenderTools()->UI()->DoLabelScaled(&Item.m_Rect, aBuf, 12.0f, TEXTALIGN_LEFT, Item.m_Rect.w);
if(g_Config.m_Debug)
{
ColorRGBA BloodColor = *UseCustomColor ? color_cast<ColorRGBA>(ColorHSLA(*ColorBody)) : s->m_BloodColor;
@ -729,7 +729,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
const char *pSearchLabel = "\xEE\xA2\xB6";
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1, -1, 0);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, -1, 0);
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f);
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
@ -875,7 +875,7 @@ void CMenus::UiDoGetButtons(int Start, int Stop, CUIRect View, CUIRect ScopeView
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_Name));
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
int OldId = Key.m_KeyId, OldModifier = Key.m_Modifier, NewModifier;
int NewId = DoKeyReader((void *)&gs_aKeys[i].m_Name, &Button, OldId, OldModifier, &NewModifier);
if(NewId != OldId || NewModifier != OldModifier)
@ -947,7 +947,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
MovementSettings.HSplitTop(20.0f, &Button, &MovementSettings);
Button.VSplitLeft(160.0f, &Label, &Button);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Mouse sens."), g_Config.m_InpMousesens);
UI()->DoLabel(&Label, aBuf, 14.0f * UI()->Scale(), -1);
UI()->DoLabel(&Label, aBuf, 14.0f * UI()->Scale(), TEXTALIGN_LEFT);
int NewValue = (int)(UIEx()->DoScrollbarH(&g_Config.m_InpMousesens, &Button, (minimum(g_Config.m_InpMousesens, 500) - 1) / 500.0f) * 500.0f) + 1;
if(g_Config.m_InpMousesens < 500 || NewValue < 500)
g_Config.m_InpMousesens = minimum(NewValue, 500);
@ -959,7 +959,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
MovementSettings.HSplitTop(20.0f, &Button, &MovementSettings);
Button.VSplitLeft(160.0f, &Label, &Button);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("UI mouse s."), g_Config.m_UiMousesens);
UI()->DoLabel(&Label, aBuf, 14.0f * UI()->Scale(), -1);
UI()->DoLabel(&Label, aBuf, 14.0f * UI()->Scale(), TEXTALIGN_LEFT);
int NewValue = (int)(UIEx()->DoScrollbarH(&g_Config.m_UiMousesens, &Button, (minimum(g_Config.m_UiMousesens, 500) - 1) / 500.0f) * 500.0f) + 1;
if(g_Config.m_UiMousesens < 500 || NewValue < 500)
g_Config.m_UiMousesens = minimum(NewValue, 500);
@ -1064,7 +1064,7 @@ int CMenus::RenderDropDown(int &CurDropDownState, CUIRect *pRect, int CurSelecti
if(Item.m_Visible)
{
str_format(aBuf, sizeof(aBuf), "%s", pStr[i]);
UI()->DoLabelScaled(&Item.m_Rect, aBuf, 16.0f, 0);
UI()->DoLabelScaled(&Item.m_Rect, aBuf, 16.0f, TEXTALIGN_CENTER);
}
}
bool ClickedItem = false;
@ -1136,7 +1136,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
int G = gcd(g_Config.m_GfxScreenWidth, g_Config.m_GfxScreenHeight);
str_format(aBuf, sizeof(aBuf), "%s: %dx%d @%dhz %d bit (%d:%d)", Localize("Current"), int(g_Config.m_GfxScreenWidth * Graphics()->ScreenHiDPIScale()), int(g_Config.m_GfxScreenHeight * Graphics()->ScreenHiDPIScale()), g_Config.m_GfxScreenRefreshRate, g_Config.m_GfxColorDepth, g_Config.m_GfxScreenWidth / G, g_Config.m_GfxScreenHeight / G);
UI()->DoLabelScaled(&ModeLabel, aBuf, sc_FontSizeResListHeader, 0);
UI()->DoLabelScaled(&ModeLabel, aBuf, sc_FontSizeResListHeader, TEXTALIGN_CENTER);
UiDoListboxStart(&s_NumNodes, &ModeList, sc_RowHeightResList, Localize("Display Modes"), aBuf, s_NumNodes - 1, 1, OldSelected, s_ScrollValue);
for(int i = 0; i < s_NumNodes; ++i)
@ -1155,7 +1155,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
{
int G = gcd(s_aModes[i].m_CanvasWidth, s_aModes[i].m_CanvasHeight);
str_format(aBuf, sizeof(aBuf), " %dx%d @%dhz %d bit (%d:%d)", s_aModes[i].m_CanvasWidth, s_aModes[i].m_CanvasHeight, s_aModes[i].m_RefreshRate, Depth, s_aModes[i].m_CanvasWidth / G, s_aModes[i].m_CanvasHeight / G);
UI()->DoLabelScaled(&Item.m_Rect, aBuf, sc_FontSizeResList, -1);
UI()->DoLabelScaled(&Item.m_Rect, aBuf, sc_FontSizeResList, TEXTALIGN_LEFT);
}
}
@ -1303,7 +1303,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i Hz", Localize("Refresh Rate"), g_Config.m_GfxRefreshRate);
else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Refresh Rate"), "");
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
int NewRefreshRate = static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_GfxRefreshRate, &Button, (minimum(g_Config.m_GfxRefreshRate, 1000)) / 1000.0f) * 1000.0f + 0.1f);
if(g_Config.m_GfxRefreshRate <= 1000 || NewRefreshRate < 1000)
g_Config.m_GfxRefreshRate = NewRefreshRate;
@ -1312,7 +1312,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
MainView.HSplitTop(20.0f, 0, &MainView);
MainView.HSplitTop(20.0f, &Text, &MainView);
//text.VSplitLeft(15.0f, 0, &text);
UI()->DoLabelScaled(&Text, Localize("UI Color"), 14.0f, -1);
UI()->DoLabelScaled(&Text, Localize("UI Color"), 14.0f, TEXTALIGN_LEFT);
RenderHSLScrollbars(&MainView, &g_Config.m_UiColor, true);
}
@ -1394,7 +1394,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_SndRate);
MainView.HSplitTop(20.0f, &Button, &MainView);
UI()->DoLabelScaled(&Button, Localize("Sample rate"), 14.0f, -1);
UI()->DoLabelScaled(&Button, Localize("Sample rate"), 14.0f, TEXTALIGN_LEFT);
Button.VSplitLeft(190.0f, 0, &Button);
static float s_Offset = 0.0f;
UIEx()->DoEditBox(&g_Config.m_SndRate, &Button, aBuf, sizeof(aBuf), 14.0f, &s_Offset);
@ -1408,7 +1408,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Sound volume"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Sound volume"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_SndVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndVolume, &Button, g_Config.m_SndVolume / 100.0f) * 100.0f);
}
@ -1418,7 +1418,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Game sound volume"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Game sound volume"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_SndGameSoundVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndGameSoundVolume, &Button, g_Config.m_SndGameSoundVolume / 100.0f) * 100.0f);
}
@ -1428,7 +1428,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Chat sound volume"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Chat sound volume"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_SndChatSoundVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndChatSoundVolume, &Button, g_Config.m_SndChatSoundVolume / 100.0f) * 100.0f);
}
@ -1438,7 +1438,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Map sound volume"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Map sound volume"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_SndMapSoundVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndMapSoundVolume, &Button, g_Config.m_SndMapSoundVolume / 100.0f) * 100.0f);
}
@ -1448,7 +1448,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Background music volume"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Background music volume"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_SndBackgroundMusicVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndBackgroundMusicVolume, &Button, g_Config.m_SndBackgroundMusicVolume / 100.0f) * 100.0f);
}
}
@ -1563,7 +1563,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f);
m_pClient->m_CountryFlags.Render(r.front().m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h);
Item.m_Rect.HSplitTop(2.0f, 0, &Item.m_Rect);
UI()->DoLabelScaled(&Item.m_Rect, r.front().m_Name, 16.0f, -1);
UI()->DoLabelScaled(&Item.m_Rect, r.front().m_Name, 16.0f, TEXTALIGN_LEFT);
}
}
@ -1674,11 +1674,11 @@ void CMenus::RenderSettings(CUIRect MainView)
if(m_NeedRestartUpdate)
{
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
UI()->DoLabelScaled(&RestartWarning, Localize("DDNet Client needs to be restarted to complete update!"), 14.0f, -1);
UI()->DoLabelScaled(&RestartWarning, Localize("DDNet Client needs to be restarted to complete update!"), 14.0f, TEXTALIGN_LEFT);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
}
else if(m_NeedRestartGeneral || m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound || m_NeedRestartDDNet)
UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, -1);
UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, TEXTALIGN_LEFT);
RenderColorPicker();
}
@ -2021,7 +2021,7 @@ ColorHSLA CMenus::RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool
Button.Margin(2.0f, &Rail);
str_format(aBuf, sizeof(aBuf), "%s: %03d", aLabels[i], (int)(*paComponent[i] * 255));
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
ColorHSLA CurColorPureHSLA(RenderColorHSLA.r, 1, 0.5f, 1);
ColorRGBA CurColorPure = color_cast<ColorRGBA>(CurColorPureHSLA);
@ -2090,7 +2090,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.VSplitLeft(MainView.w * 0.55, &MainView, &Column);
MainView.HSplitTop(30.0f, &Section, &MainView);
UI()->DoLabelScaled(&Section, Localize("HUD"), 20.0f, -1);
UI()->DoLabelScaled(&Section, Localize("HUD"), 20.0f, TEXTALIGN_LEFT);
MainView.VSplitLeft(5.0f, 0x0, &MainView);
MainView.HSplitTop(5.0f, 0x0, &MainView);
@ -2111,7 +2111,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
// ***** Kill Messages ***** //
MainView.HSplitTop(30.0f, &Section, &MainView);
UI()->DoLabelScaled(&Section, Localize("Kill Messages"), 20.0f, -1);
UI()->DoLabelScaled(&Section, Localize("Kill Messages"), 20.0f, TEXTALIGN_LEFT);
MainView.VSplitLeft(5.0f, 0x0, &MainView);
MainView.HSplitTop(10.0f, 0x0, &MainView);
@ -2127,7 +2127,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView = Column;
MainView.HSplitTop(30.0f, &Section, &MainView);
UI()->DoLabelScaled(&Section, Localize("Laser"), 20.0f, -1);
UI()->DoLabelScaled(&Section, Localize("Laser"), 20.0f, TEXTALIGN_LEFT);
MainView.VSplitLeft(5.0f, 0x0, &MainView);
MainView.HSplitTop(5.0f, 0x0, &MainView);
@ -2151,7 +2151,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.HSplitTop(25.0f, 0x0, &MainView);
MainView.HSplitTop(20.0f, &SectionTwo, &MainView);
UI()->DoLabelScaled(&SectionTwo, Localize("Hookline"), 20.0f, -1);
UI()->DoLabelScaled(&SectionTwo, Localize("Hookline"), 20.0f, TEXTALIGN_LEFT);
MainView.HSplitTop(5.0f, 0x0, &MainView);
MainView.HSplitTop(25.0f, &SectionTwo, &MainView);
@ -2184,7 +2184,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.HSplitTop(20.0f, &Section, &MainView);
MainView.HSplitTop(10.0f, 0x0, &MainView);
UI()->DoLabelScaled(&Section, Localize("Messages"), 20.0f, -1);
UI()->DoLabelScaled(&Section, Localize("Messages"), 20.0f, TEXTALIGN_LEFT);
const float LineSize = 25.0f;
const float WantedPickerPosition = 210.0f;
@ -2212,7 +2212,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.HSplitTop(10.0f, 0x0, &MainView);
MainView.HSplitTop(20.0f, &Section, &MainView);
UI()->DoLabelScaled(&Section, Localize("Preview"), 20.0f, -1);
UI()->DoLabelScaled(&Section, Localize("Preview"), 20.0f, TEXTALIGN_LEFT);
MainView.HSplitTop(10.0f, 0x0, &MainView);
RenderTools()->DrawUIRect(&MainView, ColorRGBA(1, 1, 1, 0.1f), CUI::CORNER_ALL, 8.0f);
@ -2398,7 +2398,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
MainView.HSplitTop(100.0f, &Demo, &MainView);
Demo.HSplitTop(30.0f, &Label, &Demo);
UI()->DoLabelScaled(&Label, Localize("Demo"), 20.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Demo"), 20.0f, TEXTALIGN_LEFT);
Demo.Margin(5.0f, &Demo);
Demo.VSplitMid(&Left, &Right);
Left.VSplitRight(5.0f, &Left, 0);
@ -2418,7 +2418,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Button.VSplitLeft(140.0f, &Label, &Button);
char aBuf[256];
str_format(aBuf, sizeof(aBuf), Localize("Default length: %d"), g_Config.m_ClReplayLength);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
int NewValue = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClReplayLength, &Button, (minimum(g_Config.m_ClReplayLength, 600) - 10) / 590.0f) * 590.0f) + 10;
if(g_Config.m_ClReplayLength < 600 || NewValue < 600)
@ -2464,7 +2464,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
MainView.HSplitTop(330.0f, &Gameplay, &MainView);
Gameplay.HSplitTop(30.0f, &Label, &Gameplay);
UI()->DoLabelScaled(&Label, Localize("Gameplay"), 20.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Gameplay"), 20.0f, TEXTALIGN_LEFT);
Gameplay.Margin(5.0f, &Gameplay);
Gameplay.VSplitMid(&Left, &Right);
Left.VSplitRight(5.0f, &Left, 0);
@ -2474,7 +2474,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
CUIRect Button, Label;
Left.HSplitTop(20.0f, &Button, &Left);
Button.VSplitLeft(120.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Overlay entities"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Overlay entities"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_ClOverlayEntities = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClOverlayEntities, &Button, g_Config.m_ClOverlayEntities / 100.0f) * 100.0f);
}
@ -2484,7 +2484,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Button.VSplitMid(&LeftLeft, &Button);
Button.VSplitLeft(50.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Size"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Size"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_ClTextEntitiesSize = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClTextEntitiesSize, &Button, g_Config.m_ClTextEntitiesSize / 100.0f) * 100.0f);
if(DoButton_CheckBox(&g_Config.m_ClTextEntities, Localize("Show text entities"), g_Config.m_ClTextEntities, &LeftLeft))
@ -2499,7 +2499,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Button.VSplitMid(&LeftLeft, &Button);
Button.VSplitLeft(50.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Alpha"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Alpha"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_ClShowOthersAlpha = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClShowOthersAlpha, &Button, g_Config.m_ClShowOthersAlpha / 100.0f) * 100.0f);
if(DoButton_CheckBox(&g_Config.m_ClShowOthers, Localize("Show others"), g_Config.m_ClShowOthers == 1, &LeftLeft))
@ -2526,7 +2526,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Label.VSplitLeft(130.0f, &Label, &Button);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Default zoom"), g_Config.m_ClDefaultZoom);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
g_Config.m_ClDefaultZoom = static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClDefaultZoom, &Button, g_Config.m_ClDefaultZoom / 20.0f) * 20.0f + 0.1f);
Right.HSplitTop(20.0f, &Button, &Right);
@ -2600,13 +2600,13 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Left.HSplitTop(25.0f, &TempLabel, &Left);
Left.HSplitTop(5.0f, 0x0, &Left);
UI()->DoLabelScaled(&TempLabel, Localize("Background"), 20.0f, -1);
UI()->DoLabelScaled(&TempLabel, Localize("Background"), 20.0f, TEXTALIGN_LEFT);
Right.HSplitTop(45.0f, 0x0, &Right);
Right.HSplitTop(25.0f, &TempLabel, &Right);
Right.HSplitTop(5.0f, 0x0, &Miscellaneous);
UI()->DoLabelScaled(&TempLabel, Localize("Miscellaneous"), 20.0f, -1);
UI()->DoLabelScaled(&TempLabel, Localize("Miscellaneous"), 20.0f, TEXTALIGN_LEFT);
static int ResetID1 = 0;
static int ResetID2 = 0;
@ -2617,7 +2617,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Left.HSplitTop(25.0f, &Background, &Left);
Background.HSplitTop(20.0f, &Background, 0);
Background.VSplitLeft(100.0f, &Label, &TempLabel);
UI()->DoLabelScaled(&Label, Localize("Map"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Map"), 14.0f, TEXTALIGN_LEFT);
static float s_Map = 0.0f;
UIEx()->DoEditBox(g_Config.m_ClBackgroundEntities, &TempLabel, g_Config.m_ClBackgroundEntities, sizeof(g_Config.m_ClBackgroundEntities), 14.0f, &s_Map);
@ -2656,7 +2656,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Right.HSplitTop(5.0f, 0, &Right);
Right.HSplitTop(20.0f, &Right, 0);
Right.VSplitLeft(100.0f, &Label, &TempLabel2);
UI()->DoLabelScaled(&Label, Localize("Run on join"), 14.0f, -1);
UI()->DoLabelScaled(&Label, Localize("Run on join"), 14.0f, TEXTALIGN_LEFT);
UIEx()->DoEditBox(g_Config.m_ClRunOnJoin, &TempLabel2, g_Config.m_ClRunOnJoin, sizeof(g_Config.m_ClRunOnJoin), 14.0f, &s_RunOnJoin, false, CUI::CORNER_ALL, Localize("Chat command (e.g. showall 1)"));
// Updater
#if defined(CONF_AUTOUPDATE)
@ -2698,7 +2698,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Client()->RequestDDNetInfo();
}
}
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
}
#endif

View file

@ -461,7 +461,7 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
CUIRect TextureRect;
ItemRect.HSplitTop(15, &ItemRect, &TextureRect);
TextureRect.HSplitTop(10, NULL, &TextureRect);
UI()->DoLabelScaled(&ItemRect, s->m_aName, ItemRect.h - 2, 0);
UI()->DoLabelScaled(&ItemRect, s->m_aName, ItemRect.h - 2, TEXTALIGN_CENTER);
if(s->m_RenderTexture.IsValid())
{
Graphics()->WrapClamp();
@ -512,7 +512,7 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
const char *pSearchLabel = "\xEE\xA2\xB6";
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1, -1, 0);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, -1, 0);
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f);
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);

View file

@ -201,7 +201,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), Localize("DDNet Client updated!"));
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
}
UI()->DoLabel(&VersionUpdate, aBuf, 14.0f, -1);
UI()->DoLabel(&VersionUpdate, aBuf, 14.0f, TEXTALIGN_LEFT);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
VersionUpdate.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1, -1.0f) + 10.0f, 0, &Part);
@ -244,12 +244,12 @@ void CMenus::RenderStartMenu(CUIRect MainView)
char aBuf[64];
str_format(aBuf, sizeof(aBuf), Localize("DDNet %s is out!"), Client()->LatestVersion());
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
UI()->DoLabel(&VersionUpdate, aBuf, 14.0f, 0);
UI()->DoLabel(&VersionUpdate, aBuf, 14.0f, TEXTALIGN_CENTER);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
}
#endif
UI()->DoLabel(&CurVersion, GAME_RELEASE_VERSION, 14.0f, 1);
UI()->DoLabel(&CurVersion, GAME_RELEASE_VERSION, 14.0f, TEXTALIGN_RIGHT);
if(NewPage != -1)
{

View file

@ -326,7 +326,7 @@ void CVoting::RenderBars(CUIRect Bars, bool Text)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%d", m_Yes);
UI()->DoLabel(&YesArea, aBuf, Bars.h * 0.75f, 0);
UI()->DoLabel(&YesArea, aBuf, Bars.h * 0.75f, TEXTALIGN_CENTER);
}
PassArea.x += YesArea.w;
@ -344,7 +344,7 @@ void CVoting::RenderBars(CUIRect Bars, bool Text)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%d", m_No);
UI()->DoLabel(&NoArea, aBuf, Bars.h * 0.75f, 0);
UI()->DoLabel(&NoArea, aBuf, Bars.h * 0.75f, TEXTALIGN_CENTER);
}
PassArea.w -= NoArea.w;
@ -354,7 +354,7 @@ void CVoting::RenderBars(CUIRect Bars, bool Text)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%d", m_Pass);
UI()->DoLabel(&PassArea, aBuf, Bars.h * 0.75f, 0);
UI()->DoLabel(&PassArea, aBuf, Bars.h * 0.75f, TEXTALIGN_CENTER);
}
}
}

View file

@ -464,15 +464,18 @@ float CUI::DoTextLabel(float x, float y, float w, float h, const char *pText, fl
{
AlignmentVert = y + (h - AlignedSize) / 2.f - (AlignedSize - MaxCharacterHeightInLine) / 2.f;
}
if(Align == 0)
// if(Align == 0)
if(Align & TEXTALIGN_CENTER)
{
AlignmentHori = x + (w - tw) / 2.f;
}
else if(Align < 0)
// else if(Align < 0)
else if(Align & TEXTALIGN_LEFT)
{
AlignmentHori = x;
}
else if(Align > 0)
// else if(Align > 0)
else if(Align & TEXTALIGN_RIGHT)
{
AlignmentHori = x + w - tw;
}
@ -530,15 +533,18 @@ void CUI::DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, cons
{
AlignmentVert = pRect->y + (pRect->h - AlignedSize) / 2.f - (AlignedSize - MaxCharacterHeightInLine) / 2.f;
}
if(Align == 0)
// if(Align == 0)
if(Align & TEXTALIGN_CENTER)
{
AlignmentHori = pRect->x + (pRect->w - tw) / 2.f;
}
else if(Align < 0)
// else if(Align < 0)
else if(Align & TEXTALIGN_LEFT)
{
AlignmentHori = pRect->x;
}
else if(Align > 0)
// else if(Align > 0)
else if(Align & TEXTALIGN_RIGHT)
{
AlignmentHori = pRect->x + pRect->w - tw;
}

View file

@ -586,7 +586,7 @@ bool CUIEx::DoEditBox(const void *pID, const CUIRect *pRect, char *pStr, unsigne
SelCursor.m_SelectionEnd = m_CurSelEnd;
}
UI()->DoLabel(&Textbox, pDisplayStr, FontSize, -1, -1, 1, &SelCursor);
UI()->DoLabel(&Textbox, pDisplayStr, FontSize, TEXTALIGN_LEFT, -1, 1, &SelCursor);
if(UI()->LastActiveItem() == pID)
{
@ -627,7 +627,7 @@ bool CUIEx::DoClearableEditBox(const void *pID, const void *pClearID, const CUIR
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT);
RenderTools()->DrawUIRect(&ClearButton, ColorRGBA(1, 1, 1, 0.33f * UI()->ButtonColorMul(pClearID)), Corners & ~CUI::CORNER_L, 3.0f);
UI()->DoLabel(&ClearButton, "×", ClearButton.h * CUI::ms_FontmodHeight, 0, -1, 0);
UI()->DoLabel(&ClearButton, "×", ClearButton.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, -1, 0);
TextRender()->SetRenderFlags(0);
if(UI()->DoButtonLogic(pClearID, "×", 0, &ClearButton))
{

View file

@ -390,7 +390,7 @@ int CEditor::DoButton_Editor(const void *pID, const char *pText, int Checked, co
{
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_ALL, 3.0f);
CUIRect NewRect = *pRect;
UI()->DoLabel(&NewRect, pText, 10.f, 0, -1, AlignVert);
UI()->DoLabel(&NewRect, pText, 10.f, TEXTALIGN_CENTER, -1, AlignVert);
Checked %= 2;
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -402,7 +402,7 @@ int CEditor::DoButton_Env(const void *pID, const char *pText, int Checked, const
ColorRGBA Color = ColorRGBA(BaseColor.r * Bright, BaseColor.g * Bright, BaseColor.b * Bright, Alpha);
RenderTools()->DrawUIRect(pRect, Color, CUI::CORNER_ALL, 3.0f);
UI()->DoLabel(pRect, pText, 10.f, 0, -1);
UI()->DoLabel(pRect, pText, 10.f, TEXTALIGN_CENTER, -1);
Checked %= 2;
return DoButton_Editor_Common(pID, pText, Checked, pRect, 0, pToolTip);
}
@ -414,7 +414,7 @@ int CEditor::DoButton_File(const void *pID, const char *pText, int Checked, cons
CUIRect t = *pRect;
t.VMargin(5.0f, &t);
UI()->DoLabel(&t, pText, 10, -1, -1);
UI()->DoLabel(&t, pText, 10, TEXTALIGN_LEFT, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -425,7 +425,7 @@ int CEditor::DoButton_Menu(const void *pID, const char *pText, int Checked, cons
r = *pRect;
r.VMargin(5.0f, &r);
UI()->DoLabel(&r, pText, 10, -1, -1);
UI()->DoLabel(&r, pText, 10, TEXTALIGN_LEFT, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -436,7 +436,7 @@ int CEditor::DoButton_MenuItem(const void *pID, const char *pText, int Checked,
CUIRect t = *pRect;
t.VMargin(5.0f, &t);
UI()->DoLabel(&t, pText, 10, -1, -1);
UI()->DoLabel(&t, pText, 10, TEXTALIGN_LEFT, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -444,7 +444,7 @@ int CEditor::DoButton_Tab(const void *pID, const char *pText, int Checked, const
{
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_T, 5.0f);
CUIRect NewRect = *pRect;
UI()->DoLabel(&NewRect, pText, 10, 0, -1);
UI()->DoLabel(&NewRect, pText, 10, TEXTALIGN_CENTER, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -452,21 +452,21 @@ int CEditor::DoButton_Ex(const void *pID, const char *pText, int Checked, const
{
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), Corners, 3.0f);
CUIRect NewRect = *pRect;
UI()->DoLabel(&NewRect, pText, FontSize, 0, -1, AlignVert);
UI()->DoLabel(&NewRect, pText, FontSize, TEXTALIGN_CENTER, -1, AlignVert);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
int CEditor::DoButton_ButtonInc(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip)
{
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_R, 3.0f);
UI()->DoLabel(pRect, pText ? pText : "+", 10, 0, -1);
UI()->DoLabel(pRect, pText ? pText : "+", 10, TEXTALIGN_CENTER, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
int CEditor::DoButton_ButtonDec(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip)
{
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_L, 3.0f);
UI()->DoLabel(pRect, pText ? pText : "-", 10, 0, -1);
UI()->DoLabel(pRect, pText ? pText : "-", 10, TEXTALIGN_CENTER, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -642,7 +642,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
else
str_format(aBuf, sizeof(aBuf), "%d", Current);
RenderTools()->DrawUIRect(pRect, Color ? *Color : GetButtonColor(pID, 0), Corners, 5.0f);
UI()->DoLabel(pRect, aBuf, 10, 0, -1);
UI()->DoLabel(pRect, aBuf, 10, TEXTALIGN_CENTER, -1);
}
return Current;
@ -2775,7 +2775,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
CUIRect Label, Shifter;
Slot.VSplitMid(&Label, &Shifter);
Shifter.HMargin(1.0f, &Shifter);
UI()->DoLabel(&Label, pProps[i].m_pName, 10.0f, -1, -1);
UI()->DoLabel(&Label, pProps[i].m_pName, 10.0f, TEXTALIGN_LEFT, -1);
if(pProps[i].m_Type == PROPTYPE_INT_STEP)
{
@ -2945,11 +2945,11 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
Left.VSplitLeft(10.0f, &Left, &Shifter);
Shifter.VSplitRight(10.0f, &Shifter, &Right);
RenderTools()->DrawUIRect(&Shifter, ColorRGBA(1, 1, 1, 0.5f), 0, 0.0f);
UI()->DoLabel(&Shifter, "X", 10.0f, 0, -1);
UI()->DoLabel(&Shifter, "X", 10.0f, TEXTALIGN_CENTER, -1);
Up.VSplitLeft(10.0f, &Up, &Shifter);
Shifter.VSplitRight(10.0f, &Shifter, &Down);
RenderTools()->DrawUIRect(&Shifter, ColorRGBA(1, 1, 1, 0.5f), 0, 0.0f);
UI()->DoLabel(&Shifter, "Y", 10.0f, 0, -1);
UI()->DoLabel(&Shifter, "Y", 10.0f, TEXTALIGN_CENTER, -1);
if(DoButton_ButtonDec(&pIDs[i], "-", 0, &Left, 0, "Left"))
{
*pNewVal = 1;
@ -3027,7 +3027,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
float FontSize = ScaleFontSize(aBuf, sizeof(aBuf), 10.0f, Shifter.w);
RenderTools()->DrawUIRect(&Shifter, Color, 0, 5.0f);
UI()->DoLabel(&Shifter, aBuf, FontSize, 0, -1);
UI()->DoLabel(&Shifter, aBuf, FontSize, TEXTALIGN_CENTER, -1);
if(DoButton_ButtonDec((char *)&pIDs[i] + 1, 0, 0, &Dec, 0, "Previous Envelope"))
{
@ -3750,9 +3750,9 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect View)
{
ToolBox.HSplitTop(15.0f, &Slot, &ToolBox);
if(e == 0)
UI()->DoLabel(&Slot, "Embedded", 12.0f, 0);
UI()->DoLabel(&Slot, "Embedded", 12.0f, TEXTALIGN_CENTER);
else
UI()->DoLabel(&Slot, "External", 12.0f, 0);
UI()->DoLabel(&Slot, "External", 12.0f, TEXTALIGN_CENTER);
}
ImageCur += 15.0f;
@ -3961,7 +3961,7 @@ void CEditor::RenderSounds(CUIRect ToolBox, CUIRect View)
CUIRect Slot;
ToolBox.HSplitTop(15.0f, &Slot, &ToolBox);
UI()->DoLabel(&Slot, "Embedded", 12.0f, 0);
UI()->DoLabel(&Slot, "Embedded", 12.0f, TEXTALIGN_CENTER);
SoundCur += 15.0f;
for(int i = 0; i < m_Map.m_lSounds.size(); i++)
@ -4134,7 +4134,7 @@ void CEditor::RenderFileDialog()
// title
RenderTools()->DrawUIRect(&Title, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 4.0f);
Title.VMargin(10.0f, &Title);
UI()->DoLabel(&Title, m_pFileDialogTitle, 12.0f, -1, -1);
UI()->DoLabel(&Title, m_pFileDialogTitle, 12.0f, TEXTALIGN_LEFT, -1);
// pathbox
char aPath[128], aBuf[128];
@ -4143,12 +4143,12 @@ void CEditor::RenderFileDialog()
else
aPath[0] = 0;
str_format(aBuf, sizeof(aBuf), "Current path: %s", aPath);
UI()->DoLabel(&PathBox, aBuf, 10.0f, -1, -1);
UI()->DoLabel(&PathBox, aBuf, 10.0f, TEXTALIGN_LEFT, -1);
if(m_FileDialogStorageType == IStorage::TYPE_SAVE)
{
// filebox
UI()->DoLabel(&FileBoxLabel, "Filename:", 10.0f, -1, -1);
UI()->DoLabel(&FileBoxLabel, "Filename:", 10.0f, TEXTALIGN_LEFT, -1);
static float s_FileBoxID = 0;
if(DoEditBox(&s_FileBoxID, &FileBox, m_aFileDialogFileName, sizeof(m_aFileDialogFileName), 10.0f, &s_FileBoxID))
{
@ -4169,7 +4169,7 @@ void CEditor::RenderFileDialog()
CUIRect ClearBox;
FileBox.VSplitRight(15, &FileBox, &ClearBox);
UI()->DoLabel(&FileBoxLabel, "Search:", 10.0f, -1, -1);
UI()->DoLabel(&FileBoxLabel, "Search:", 10.0f, TEXTALIGN_LEFT, -1);
str_copy(m_aFileDialogPrevSearchText, m_aFileDialogSearchText, sizeof(m_aFileDialogPrevSearchText));
static float s_SearchBoxID = 0;
DoEditBox(&s_SearchBoxID, &FileBox, m_aFileDialogSearchText, sizeof(m_aFileDialogSearchText), 10.0f, &s_SearchBoxID, false, CUI::CORNER_L);
@ -4180,7 +4180,7 @@ void CEditor::RenderFileDialog()
{
static int s_ClearButton = 0;
RenderTools()->DrawUIRect(&ClearBox, ColorRGBA(1, 1, 1, 0.33f * UI()->ButtonColorMul(&s_ClearButton)), CUI::CORNER_R, 3.0f);
UI()->DoLabel(&ClearBox, "×", 10.0f, 0);
UI()->DoLabel(&ClearBox, "×", 10.0f, TEXTALIGN_CENTER);
if(UI()->DoButtonLogic(&s_ClearButton, "×", 0, &ClearBox))
{
m_aFileDialogSearchText[0] = 0;
@ -4574,7 +4574,7 @@ void CEditor::RenderStatusbar(CUIRect View)
str_copy(aBuf, m_pTooltip, sizeof(aBuf));
float FontSize = ScaleFontSize(aBuf, sizeof(aBuf), 10.0f, View.w);
UI()->DoLabel(&View, aBuf, FontSize, -1, View.w);
UI()->DoLabel(&View, aBuf, FontSize, TEXTALIGN_LEFT, View.w);
}
}
@ -4775,7 +4775,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
}
RenderTools()->DrawUIRect(&Shifter, EnvColor, 0, 0.0f);
UI()->DoLabel(&Shifter, aBuf, 10.0f, 0, -1);
UI()->DoLabel(&Shifter, aBuf, 10.0f, TEXTALIGN_CENTER, -1);
static int s_PrevButton = 0;
if(DoButton_ButtonDec(&s_PrevButton, 0, 0, &Dec, 0, "Previous Envelope"))
@ -4799,7 +4799,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
{
ToolBar.VSplitLeft(15.0f, &Button, &ToolBar);
ToolBar.VSplitLeft(35.0f, &Button, &ToolBar);
UI()->DoLabel(&Button, "Name:", 10.0f, -1, -1);
UI()->DoLabel(&Button, "Name:", 10.0f, TEXTALIGN_LEFT, -1);
ToolBar.VSplitLeft(80.0f, &Button, &ToolBar);
@ -4875,7 +4875,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
ToolBar.VSplitLeft(4.0f, &Button, &ToolBar);
ToolBar.VSplitLeft(80.0f, &Button, &ToolBar);
UI()->DoLabel(&Button, "Synchronized", 10.0f, -1, -1);
UI()->DoLabel(&Button, "Synchronized", 10.0f, TEXTALIGN_LEFT, -1);
}
float EndTime = pEnvelope->EndTime();
@ -5200,8 +5200,8 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
ToolBar1.VSplitMid(&Label1, &ToolBar1);
ToolBar2.VSplitMid(&Label2, &ToolBar2);
UI()->DoLabel(&Label1, "Value:", 10.0f, -1, -1);
UI()->DoLabel(&Label2, "Time (in s):", 10.0f, -1, -1);
UI()->DoLabel(&Label1, "Value:", 10.0f, TEXTALIGN_LEFT, -1);
UI()->DoLabel(&Label2, "Time (in s):", 10.0f, TEXTALIGN_LEFT, -1);
}
static float s_ValNumber = 0;
@ -5226,7 +5226,7 @@ void CEditor::RenderServerSettingsEditor(CUIRect View, bool ShowServerSettingsEd
// command line
ToolBar.VSplitLeft(5.0f, 0, &Button);
UI()->DoLabel(&Button, "Command:", 12.0f, -1);
UI()->DoLabel(&Button, "Command:", 12.0f, TEXTALIGN_LEFT);
Button.VSplitLeft(70.0f, 0, &Button);
Button.VSplitLeft(180.0f, &Button, 0);
@ -5529,13 +5529,13 @@ void CEditor::RenderMenubar(CUIRect MenuBar)
MenuBar.VSplitLeft(MenuBar.w * 0.75f, &MenuBar, &Info);
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "File: %s", m_aFileName);
UI()->DoLabel(&MenuBar, aBuf, 10.0f, -1, -1);
UI()->DoLabel(&MenuBar, aBuf, 10.0f, TEXTALIGN_LEFT, -1);
char aTimeStr[6];
str_timestamp_format(aTimeStr, sizeof(aTimeStr), "%H:%M");
str_format(aBuf, sizeof(aBuf), "X: %i, Y: %i, Z: %i, A: %.1f, G: %i %s", (int)UI()->MouseWorldX() / 32, (int)UI()->MouseWorldY() / 32, m_ZoomLevel, m_AnimateSpeed, m_GridFactor, aTimeStr);
UI()->DoLabel(&Info, aBuf, 10.0f, 1, -1);
UI()->DoLabel(&Info, aBuf, 10.0f, TEXTALIGN_RIGHT, -1);
static int s_CloseButton = 0;
if(DoButton_Editor(&s_CloseButton, "×", 0, &Close, 0, "Exits from the editor", 0) || (m_Dialog == DIALOG_NONE && !UiPopupOpen() && !m_PopupEventActivated && Input()->KeyPress(KEY_ESCAPE)))

View file

@ -1018,7 +1018,7 @@ int CLayerTiles::RenderCommonProperties(SCommonPropState &State, CEditor *pEdito
Warning.HMargin(0.5f, &Warning);
pEditor->TextRender()->TextColor(ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));
pEditor->UI()->DoLabel(&Warning, "Editing multiple layers", 9.0f, -1, Warning.w);
pEditor->UI()->DoLabel(&Warning, "Editing multiple layers", 9.0f, TEXTALIGN_LEFT, Warning.w);
pEditor->TextRender()->TextColor(ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
pToolbox->HSplitTop(2.0f, 0, pToolbox);
}

View file

@ -306,7 +306,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
{
View.HSplitBottom(5.0f, &View, &Button);
View.HSplitBottom(12.0f, &View, &Button);
pEditor->UI()->DoLabel(&Button, "Name:", 10.0f, -1, -1);
pEditor->UI()->DoLabel(&Button, "Name:", 10.0f, TEXTALIGN_LEFT, -1);
Button.VSplitLeft(40.0f, 0, &Button);
static float s_Name = 0;
if(pEditor->DoEditBox(&s_Name, &Button, pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_aName, sizeof(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_aName), 10.0f, &s_Name))
@ -421,7 +421,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View, void *pContext)
{
View.HSplitBottom(5.0f, &View, &Button);
View.HSplitBottom(12.0f, &View, &Button);
pEditor->UI()->DoLabel(&Button, "Name:", 10.0f, -1, -1);
pEditor->UI()->DoLabel(&Button, "Name:", 10.0f, TEXTALIGN_LEFT, -1);
Button.VSplitLeft(40.0f, 0, &Button);
static float s_Name = 0;
if(pEditor->DoEditBox(&s_Name, &Button, pEditor->GetSelectedLayer(0)->m_aName, sizeof(pEditor->GetSelectedLayer(0)->m_aName), 10.0f, &s_Name))
@ -975,7 +975,7 @@ int CEditor::PopupNewFolder(CEditor *pEditor, CUIRect View, void *pContext)
// title
View.HSplitTop(10.0f, 0, &View);
View.HSplitTop(30.0f, &Label, &View);
pEditor->UI()->DoLabel(&Label, "Create new folder", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Create new folder", 20.0f, TEXTALIGN_CENTER);
View.HSplitBottom(10.0f, &View, 0);
View.HSplitBottom(20.0f, &View, &ButtonBar);
@ -989,7 +989,7 @@ int CEditor::PopupNewFolder(CEditor *pEditor, CUIRect View, void *pContext)
static float s_FolderBox = 0;
pEditor->DoEditBox(&s_FolderBox, &Label, pEditor->m_aFileDialogNewFolderName, sizeof(pEditor->m_aFileDialogNewFolderName), 15.0f, &s_FolderBox);
View.HSplitBottom(20.0f, &View, &Label);
pEditor->UI()->DoLabel(&Label, "Name:", 10.0f, -1);
pEditor->UI()->DoLabel(&Label, "Name:", 10.0f, TEXTALIGN_LEFT);
// button bar
ButtonBar.VSplitLeft(30.0f, 0, &ButtonBar);
@ -1023,9 +1023,9 @@ int CEditor::PopupNewFolder(CEditor *pEditor, CUIRect View, void *pContext)
View.HSplitTop(30.0f, 0, &View);
View.VMargin(40.0f, &View);
View.HSplitTop(20.0f, &Label, &View);
pEditor->UI()->DoLabel(&Label, "Error:", 10.0f, -1);
pEditor->UI()->DoLabel(&Label, "Error:", 10.0f, TEXTALIGN_LEFT);
View.HSplitTop(20.0f, &Label, &View);
pEditor->UI()->DoLabel(&Label, "Unable to create the folder", 10.0f, -1, View.w);
pEditor->UI()->DoLabel(&Label, "Unable to create the folder", 10.0f, TEXTALIGN_LEFT, View.w);
// button
ButtonBar.VMargin(ButtonBar.w / 2.0f - 55.0f, &ButtonBar);
@ -1044,7 +1044,7 @@ int CEditor::PopupMapInfo(CEditor *pEditor, CUIRect View, void *pContext)
// title
View.HSplitTop(10.0f, 0, &View);
View.HSplitTop(30.0f, &Label, &View);
pEditor->UI()->DoLabel(&Label, "Map details", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Map details", 20.0f, TEXTALIGN_CENTER);
View.HSplitBottom(10.0f, &View, 0);
View.HSplitBottom(20.0f, &View, &ButtonBar);
@ -1053,7 +1053,7 @@ int CEditor::PopupMapInfo(CEditor *pEditor, CUIRect View, void *pContext)
// author box
View.HSplitTop(20.0f, &Label, &View);
pEditor->UI()->DoLabel(&Label, "Author:", 10.0f, -1);
pEditor->UI()->DoLabel(&Label, "Author:", 10.0f, TEXTALIGN_LEFT);
Label.VSplitLeft(45.0f, 0, &Button);
Button.HMargin(3, &Button);
static float s_AuthorBox = 0;
@ -1061,7 +1061,7 @@ int CEditor::PopupMapInfo(CEditor *pEditor, CUIRect View, void *pContext)
// version box
View.HSplitTop(20.0f, &Label, &View);
pEditor->UI()->DoLabel(&Label, "Version:", 10.0f, -1);
pEditor->UI()->DoLabel(&Label, "Version:", 10.0f, TEXTALIGN_LEFT);
Label.VSplitLeft(45.0f, 0, &Button);
Button.HMargin(3, &Button);
static float s_VersionBox = 0;
@ -1069,7 +1069,7 @@ int CEditor::PopupMapInfo(CEditor *pEditor, CUIRect View, void *pContext)
// credits box
View.HSplitTop(20.0f, &Label, &View);
pEditor->UI()->DoLabel(&Label, "Credits:", 10.0f, -1);
pEditor->UI()->DoLabel(&Label, "Credits:", 10.0f, TEXTALIGN_LEFT);
Label.VSplitLeft(45.0f, 0, &Button);
Button.HMargin(3, &Button);
static float s_CreditsBox = 0;
@ -1077,7 +1077,7 @@ int CEditor::PopupMapInfo(CEditor *pEditor, CUIRect View, void *pContext)
// license box
View.HSplitTop(20.0f, &Label, &View);
pEditor->UI()->DoLabel(&Label, "License:", 10.0f, -1);
pEditor->UI()->DoLabel(&Label, "License:", 10.0f, TEXTALIGN_LEFT);
Label.VSplitLeft(45.0f, 0, &Button);
Button.HMargin(3, &Button);
static float s_LicenseBox = 0;
@ -1113,23 +1113,23 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View, void *pContext)
View.HSplitTop(10.0f, 0, &View);
View.HSplitTop(30.0f, &Label, &View);
if(pEditor->m_PopupEventType == POPEVENT_EXIT)
pEditor->UI()->DoLabel(&Label, "Exit the editor", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Exit the editor", 20.0f, TEXTALIGN_CENTER);
else if(pEditor->m_PopupEventType == POPEVENT_LOAD)
pEditor->UI()->DoLabel(&Label, "Load map", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Load map", 20.0f, TEXTALIGN_CENTER);
else if(pEditor->m_PopupEventType == POPEVENT_NEW)
pEditor->UI()->DoLabel(&Label, "New map", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "New map", 20.0f, TEXTALIGN_CENTER);
else if(pEditor->m_PopupEventType == POPEVENT_SAVE)
pEditor->UI()->DoLabel(&Label, "Save map", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Save map", 20.0f, TEXTALIGN_CENTER);
else if(pEditor->m_PopupEventType == POPEVENT_LARGELAYER)
pEditor->UI()->DoLabel(&Label, "Large layer", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Large layer", 20.0f, TEXTALIGN_CENTER);
else if(pEditor->m_PopupEventType == POPEVENT_PREVENTUNUSEDTILES)
pEditor->UI()->DoLabel(&Label, "Unused tiles disabled", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Unused tiles disabled", 20.0f, TEXTALIGN_CENTER);
else if(pEditor->m_PopupEventType == POPEVENT_IMAGEDIV16)
pEditor->UI()->DoLabel(&Label, "Image width/height", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Image width/height", 20.0f, TEXTALIGN_CENTER);
else if(pEditor->m_PopupEventType == POPEVENT_IMAGE_MAX)
pEditor->UI()->DoLabel(&Label, "Max images", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Max images", 20.0f, TEXTALIGN_CENTER);
else if(pEditor->m_PopupEventType == POPEVENT_PLACE_BORDER_TILES)
pEditor->UI()->DoLabel(&Label, "Place border tiles", 20.0f, 0);
pEditor->UI()->DoLabel(&Label, "Place border tiles", 20.0f, TEXTALIGN_CENTER);
View.HSplitBottom(10.0f, &View, 0);
View.HSplitBottom(20.0f, &View, &ButtonBar);
@ -1139,23 +1139,23 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View, void *pContext)
View.VMargin(40.0f, &View);
View.HSplitTop(20.0f, &Label, &View);
if(pEditor->m_PopupEventType == POPEVENT_EXIT)
pEditor->UI()->DoLabel(&Label, "The map contains unsaved data, you might want to save it before you exit the editor.\nContinue anyway?", 10.0f, -1, Label.w - 10.0f);
pEditor->UI()->DoLabel(&Label, "The map contains unsaved data, you might want to save it before you exit the editor.\nContinue anyway?", 10.0f, TEXTALIGN_LEFT, Label.w - 10.0f);
else if((pEditor->m_PopupEventType == POPEVENT_LOAD) || (pEditor->m_PopupEventType == POPEVENT_LOADCURRENT))
pEditor->UI()->DoLabel(&Label, "The map contains unsaved data, you might want to save it before you load a new map.\nContinue anyway?", 10.0f, -1, Label.w - 10.0f);
pEditor->UI()->DoLabel(&Label, "The map contains unsaved data, you might want to save it before you load a new map.\nContinue anyway?", 10.0f, TEXTALIGN_LEFT, Label.w - 10.0f);
else if(pEditor->m_PopupEventType == POPEVENT_NEW)
pEditor->UI()->DoLabel(&Label, "The map contains unsaved data, you might want to save it before you create a new map.\nContinue anyway?", 10.0f, -1, Label.w - 10.0f);
pEditor->UI()->DoLabel(&Label, "The map contains unsaved data, you might want to save it before you create a new map.\nContinue anyway?", 10.0f, TEXTALIGN_LEFT, Label.w - 10.0f);
else if(pEditor->m_PopupEventType == POPEVENT_SAVE)
pEditor->UI()->DoLabel(&Label, "The file already exists.\nDo you want to overwrite the map?", 10.0f, -1);
pEditor->UI()->DoLabel(&Label, "The file already exists.\nDo you want to overwrite the map?", 10.0f, TEXTALIGN_LEFT);
else if(pEditor->m_PopupEventType == POPEVENT_LARGELAYER)
pEditor->UI()->DoLabel(&Label, "You are trying to set the height or width of a layer to more than 1000 tiles. This is actually possible, but only rarely necessary. It may cause the editor to work slower, larger file size as well as higher memory usage for client and server.", 10.0f, -1, Label.w - 10.0f);
pEditor->UI()->DoLabel(&Label, "You are trying to set the height or width of a layer to more than 1000 tiles. This is actually possible, but only rarely necessary. It may cause the editor to work slower, larger file size as well as higher memory usage for client and server.", 10.0f, TEXTALIGN_LEFT, Label.w - 10.0f);
else if(pEditor->m_PopupEventType == POPEVENT_PREVENTUNUSEDTILES)
pEditor->UI()->DoLabel(&Label, "Unused tiles can't be placed by default because they could get a use later and then destroy your map.\nActivate the 'Unused' switch to be able to place every tile.", 10.0f, -1, Label.w - 10.0f);
pEditor->UI()->DoLabel(&Label, "Unused tiles can't be placed by default because they could get a use later and then destroy your map.\nActivate the 'Unused' switch to be able to place every tile.", 10.0f, TEXTALIGN_LEFT, Label.w - 10.0f);
else if(pEditor->m_PopupEventType == POPEVENT_IMAGEDIV16)
pEditor->UI()->DoLabel(&Label, "The width or height of this image is not divisible by 16. This is required for images used in tile layers.", 10.0f, -1, Label.w - 10.0f);
pEditor->UI()->DoLabel(&Label, "The width or height of this image is not divisible by 16. This is required for images used in tile layers.", 10.0f, TEXTALIGN_LEFT, Label.w - 10.0f);
else if(pEditor->m_PopupEventType == POPEVENT_IMAGE_MAX)
pEditor->UI()->DoLabel(&Label, "The client only allows a maximum of 64 images.", 10.0f, -1, Label.w - 10.0f);
pEditor->UI()->DoLabel(&Label, "The client only allows a maximum of 64 images.", 10.0f, TEXTALIGN_LEFT, Label.w - 10.0f);
else if(pEditor->m_PopupEventType == POPEVENT_PLACE_BORDER_TILES)
pEditor->UI()->DoLabel(&Label, "This is going to overwrite any existing tiles around the edges of the layer.\nContinue?", 10.0f, -1, Label.w - 10.0f);
pEditor->UI()->DoLabel(&Label, "This is going to overwrite any existing tiles around the edges of the layer.\nContinue?", 10.0f, TEXTALIGN_LEFT, Label.w - 10.0f);
// button bar
ButtonBar.VSplitLeft(30.0f, 0, &ButtonBar);