Remove ui_scale:

- remove config variable `ui_scale`
- remove `CUI::Scale`
- remove `CUI::SetScale`
- remove `CUI::DoLabelScaled`
- remove `CUIRect::Scale`
- use `CUI::DoLabel` instead of `CUI::DoLabelScaled`
- remove usages of `CUI::Scale()` and `CUIRect::Scale()`, or use 1.0f instead
This commit is contained in:
Robert Müller 2022-06-12 10:34:09 +02:00
parent 47b9bccd38
commit ffff4435c4
12 changed files with 166 additions and 204 deletions

View file

@ -420,7 +420,7 @@ ColorHSLA CMenus::DoLine_ColorPicker(int *pResetID, const float LineSize, const
float LabelWidth = TextRender()->TextWidth(0, 14.0f, pText, -1, -1.0f); float LabelWidth = TextRender()->TextWidth(0, 14.0f, pText, -1, -1.0f);
Section.VSplitLeft(LabelWidth, &Label, &Section); Section.VSplitLeft(LabelWidth, &Label, &Section);
UI()->DoLabelScaled(&Label, pText, LabelSize, TEXTALIGN_LEFT); UI()->DoLabel(&Label, pText, LabelSize, TEXTALIGN_LEFT);
float Cut = WantedPickerPosition - (SectionWidth - Section.w); float Cut = WantedPickerPosition - (SectionWidth - Section.w);
if(Cut < 5) if(Cut < 5)
@ -997,12 +997,12 @@ void CMenus::RenderNews(CUIRect MainView)
{ {
MainView.HSplitTop(30.0f, &Label, &MainView); MainView.HSplitTop(30.0f, &Label, &MainView);
aLine[Len - 1] = '\0'; aLine[Len - 1] = '\0';
UI()->DoLabelScaled(&Label, aLine + 1, 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aLine + 1, 20.0f, TEXTALIGN_LEFT);
} }
else else
{ {
MainView.HSplitTop(20.0f, &Label, &MainView); MainView.HSplitTop(20.0f, &Label, &MainView);
UI()->DoLabelScaled(&Label, aLine, 15.f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aLine, 15.f, TEXTALIGN_LEFT);
} }
} }
} }
@ -1620,35 +1620,35 @@ int CMenus::Render()
CUIRect Box, Part; CUIRect Box, Part;
Box = Screen; Box = Screen;
if(m_Popup != POPUP_FIRST_LAUNCH) if(m_Popup != POPUP_FIRST_LAUNCH)
Box.Margin(150.0f / UI()->Scale(), &Box); Box.Margin(150.0f, &Box);
// render the box // render the box
RenderTools()->DrawUIRect(&Box, BgColor, CUI::CORNER_ALL, 15.0f); RenderTools()->DrawUIRect(&Box, BgColor, CUI::CORNER_ALL, 15.0f);
Box.HSplitTop(20.f / UI()->Scale(), &Part, &Box); Box.HSplitTop(20.f, &Part, &Box);
Box.HSplitTop(24.f / UI()->Scale(), &Part, &Box); Box.HSplitTop(24.f, &Part, &Box);
Part.VMargin(20.f / UI()->Scale(), &Part); Part.VMargin(20.f, &Part);
SLabelProperties Props; SLabelProperties Props;
Props.m_MaxWidth = (int)Part.w; Props.m_MaxWidth = (int)Part.w;
if(TextRender()->TextWidth(0, 24.f, pTitle, -1, -1.0f) > Part.w) if(TextRender()->TextWidth(0, 24.f, pTitle, -1, -1.0f) > Part.w)
UI()->DoLabelScaled(&Part, pTitle, 24.f, TEXTALIGN_LEFT, Props); UI()->DoLabel(&Part, pTitle, 24.f, TEXTALIGN_LEFT, Props);
else else
UI()->DoLabelScaled(&Part, pTitle, 24.f, TEXTALIGN_CENTER); UI()->DoLabel(&Part, pTitle, 24.f, TEXTALIGN_CENTER);
Box.HSplitTop(20.f / UI()->Scale(), &Part, &Box); Box.HSplitTop(20.f, &Part, &Box);
Box.HSplitTop(24.f / UI()->Scale(), &Part, &Box); Box.HSplitTop(24.f, &Part, &Box);
Part.VMargin(20.f / UI()->Scale(), &Part); Part.VMargin(20.f, &Part);
float FontSize = m_Popup == POPUP_FIRST_LAUNCH ? 16.0f : 20.f; float FontSize = m_Popup == POPUP_FIRST_LAUNCH ? 16.0f : 20.f;
Props.m_MaxWidth = (int)Part.w; Props.m_MaxWidth = (int)Part.w;
if(ExtraAlign == -1) if(ExtraAlign == -1)
UI()->DoLabelScaled(&Part, pExtraText, FontSize, TEXTALIGN_LEFT, Props); UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_LEFT, Props);
else else
{ {
if(TextRender()->TextWidth(0, FontSize, pExtraText, -1, -1.0f) > Part.w) if(TextRender()->TextWidth(0, FontSize, pExtraText, -1, -1.0f) > Part.w)
UI()->DoLabelScaled(&Part, pExtraText, FontSize, TEXTALIGN_LEFT, Props); UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_LEFT, Props);
else else
UI()->DoLabelScaled(&Part, pExtraText, FontSize, TEXTALIGN_CENTER); UI()->DoLabel(&Part, pExtraText, FontSize, TEXTALIGN_CENTER);
} }
if(m_Popup == POPUP_QUIT) if(m_Popup == POPUP_QUIT)
@ -1658,12 +1658,12 @@ int CMenus::Render()
Box.HSplitBottom(24.f, &Box, &Part); Box.HSplitBottom(24.f, &Box, &Part);
// additional info // additional info
Box.VMargin(20.f / UI()->Scale(), &Box); Box.VMargin(20.f, &Box);
if(m_pClient->Editor()->HasUnsavedData()) if(m_pClient->Editor()->HasUnsavedData())
{ {
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?")); 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?"));
Props.m_MaxWidth = Part.w - 20.0f; Props.m_MaxWidth = Part.w - 20.0f;
UI()->DoLabelScaled(&Box, aBuf, 20.f, TEXTALIGN_LEFT, Props); UI()->DoLabel(&Box, aBuf, 20.f, TEXTALIGN_LEFT, Props);
} }
// buttons // buttons

View file

@ -174,11 +174,11 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
CUIRect MsgBox = View; CUIRect MsgBox = View;
if(!ServerBrowser()->NumServers() && ServerBrowser()->IsGettingServerlist()) if(!ServerBrowser()->NumServers() && ServerBrowser()->IsGettingServerlist())
UI()->DoLabelScaled(&MsgBox, Localize("Getting server list from master server"), 16.0f, TEXTALIGN_CENTER); UI()->DoLabel(&MsgBox, Localize("Getting server list from master server"), 16.0f, TEXTALIGN_CENTER);
else if(!ServerBrowser()->NumServers()) else if(!ServerBrowser()->NumServers())
UI()->DoLabelScaled(&MsgBox, Localize("No servers found"), 16.0f, TEXTALIGN_CENTER); UI()->DoLabel(&MsgBox, Localize("No servers found"), 16.0f, TEXTALIGN_CENTER);
else if(ServerBrowser()->NumServers() && !NumServers) else if(ServerBrowser()->NumServers() && !NumServers)
UI()->DoLabelScaled(&MsgBox, Localize("No servers match your filter criteria"), 16.0f, TEXTALIGN_CENTER); UI()->DoLabel(&MsgBox, Localize("No servers match your filter criteria"), 16.0f, TEXTALIGN_CENTER);
} }
static float s_ScrollValue = 0; static float s_ScrollValue = 0;
@ -218,9 +218,9 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
Friend.m_NumFound = 0; Friend.m_NumFound = 0;
auto RenderBrowserIcons = [this](CUIElement::SUIElementRect &UIRect, CUIRect *pRect, const ColorRGBA &TextColor, const ColorRGBA &TextOutlineColor, const char *pText, ETextAlignment TextAlign, bool SmallFont = false) { auto RenderBrowserIcons = [this](CUIElement::SUIElementRect &UIRect, CUIRect *pRect, const ColorRGBA &TextColor, const ColorRGBA &TextOutlineColor, const char *pText, ETextAlignment TextAlign, bool SmallFont = false) {
float FontSize = 14.0f * UI()->Scale(); float FontSize = 14.0f;
if(SmallFont) if(SmallFont)
FontSize = 6.0f * UI()->Scale(); FontSize = 6.0f;
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT)); 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); 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);
TextRender()->TextColor(TextColor); TextRender()->TextColor(TextColor);
@ -346,7 +346,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
} }
else if(ID == COL_NAME) else if(ID == COL_NAME)
{ {
float FontSize = 12.0f * UI()->Scale(); float FontSize = 12.0f;
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit & IServerBrowser::QUICK_SERVERNAME)) if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit & IServerBrowser::QUICK_SERVERNAME))
{ {
@ -381,7 +381,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
} }
} }
float FontSize = 12.0f * UI()->Scale(); float FontSize = 12.0f;
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit & IServerBrowser::QUICK_MAPNAME)) if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit & IServerBrowser::QUICK_MAPNAME))
{ {
@ -415,7 +415,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
str_format(aTemp, sizeof(aTemp), "%i/%i", pItem->m_NumFilteredPlayers, ServerBrowser()->Max(*pItem)); str_format(aTemp, sizeof(aTemp), "%i/%i", pItem->m_NumFilteredPlayers, ServerBrowser()->Max(*pItem));
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit & IServerBrowser::QUICK_PLAYER)) if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit & IServerBrowser::QUICK_PLAYER))
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1); TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1);
float FontSize = 12.0f * UI()->Scale(); float FontSize = 12.0f;
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColPlayers), &Button, aTemp, FontSize, TEXTALIGN_RIGHT, -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); TextRender()->TextColor(1, 1, 1, 1);
} }
@ -429,19 +429,19 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
TextRender()->TextColor(rgb); TextRender()->TextColor(rgb);
} }
float FontSize = 12.0f * UI()->Scale(); float FontSize = 12.0f;
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColPing), &Button, aTemp, FontSize, TEXTALIGN_RIGHT, -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); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
} }
else if(ID == COL_VERSION) else if(ID == COL_VERSION)
{ {
const char *pVersion = pItem->m_aVersion; const char *pVersion = pItem->m_aVersion;
float FontSize = 12.0f * UI()->Scale(); float FontSize = 12.0f;
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColVersion), &Button, pVersion, FontSize, TEXTALIGN_RIGHT, -1, 1, false); UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColVersion), &Button, pVersion, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
} }
else if(ID == COL_GAMETYPE) else if(ID == COL_GAMETYPE)
{ {
float FontSize = 12.0f * UI()->Scale(); float FontSize = 12.0f;
if(g_Config.m_UiColorizeGametype) if(g_Config.m_UiColorizeGametype)
{ {
@ -523,7 +523,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
SLabelProperties Props; SLabelProperties Props;
Props.m_AlignVertically = 0; Props.m_AlignVertically = 0;
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 16.0f, TEXTALIGN_LEFT, Props); UI()->DoLabel(&QuickSearch, pSearchLabel, 16.0f, TEXTALIGN_LEFT, Props);
SearchIconWidth = TextRender()->TextWidth(0, 16.0f, pSearchLabel, -1, -1.0f); SearchIconWidth = TextRender()->TextWidth(0, 16.0f, pSearchLabel, -1, -1.0f);
ExcludeIconWidth = TextRender()->TextWidth(0, 16.0f, pExcludeLabel, -1, -1.0f); ExcludeIconWidth = TextRender()->TextWidth(0, 16.0f, pExcludeLabel, -1, -1.0f);
ExcludeSearchIconMax = maximum(SearchIconWidth, ExcludeIconWidth); ExcludeSearchIconMax = maximum(SearchIconWidth, ExcludeIconWidth);
@ -534,7 +534,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
char aBufSearch[64]; char aBufSearch[64];
str_format(aBufSearch, sizeof(aBufSearch), "%s:", Localize("Search")); str_format(aBufSearch, sizeof(aBufSearch), "%s:", Localize("Search"));
UI()->DoLabelScaled(&QuickSearch, aBufSearch, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&QuickSearch, aBufSearch, 14.0f, TEXTALIGN_LEFT);
QuickSearch.VSplitLeft(SearchExcludeAddrStrMax, 0, &QuickSearch); QuickSearch.VSplitLeft(SearchExcludeAddrStrMax, 0, &QuickSearch);
QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch); QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
@ -558,7 +558,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
SLabelProperties Props; SLabelProperties Props;
Props.m_AlignVertically = 0; Props.m_AlignVertically = 0;
UI()->DoLabelScaled(&QuickExclude, pExcludeLabel, 16.0f, TEXTALIGN_LEFT, Props); UI()->DoLabel(&QuickExclude, pExcludeLabel, 16.0f, TEXTALIGN_LEFT, Props);
TextRender()->SetRenderFlags(0); TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL); TextRender()->SetCurFont(NULL);
QuickExclude.VSplitLeft(ExcludeSearchIconMax, 0, &QuickExclude); QuickExclude.VSplitLeft(ExcludeSearchIconMax, 0, &QuickExclude);
@ -566,7 +566,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
char aBufExclude[64]; char aBufExclude[64];
str_format(aBufExclude, sizeof(aBufExclude), "%s:", Localize("Exclude")); str_format(aBufExclude, sizeof(aBufExclude), "%s:", Localize("Exclude"));
UI()->DoLabelScaled(&QuickExclude, aBufExclude, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&QuickExclude, aBufExclude, 14.0f, TEXTALIGN_LEFT);
QuickExclude.VSplitLeft(SearchExcludeAddrStrMax, 0, &QuickExclude); QuickExclude.VSplitLeft(SearchExcludeAddrStrMax, 0, &QuickExclude);
QuickExclude.VSplitLeft(5.0f, 0, &QuickExclude); QuickExclude.VSplitLeft(5.0f, 0, &QuickExclude);
@ -593,9 +593,9 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
CUIRect SvrsOnline, PlysOnline; CUIRect SvrsOnline, PlysOnline;
Status3.HSplitTop(20.f, &PlysOnline, &SvrsOnline); Status3.HSplitTop(20.f, &PlysOnline, &SvrsOnline);
PlysOnline.VSplitRight(TextRender()->TextWidth(0, 12.0f, aBufPyr, -1, -1.0f), 0, &PlysOnline); PlysOnline.VSplitRight(TextRender()->TextWidth(0, 12.0f, aBufPyr, -1, -1.0f), 0, &PlysOnline);
UI()->DoLabelScaled(&PlysOnline, aBufPyr, 12.0f, TEXTALIGN_LEFT); UI()->DoLabel(&PlysOnline, aBufPyr, 12.0f, TEXTALIGN_LEFT);
SvrsOnline.VSplitRight(TextRender()->TextWidth(0, 12.0f, aBufSvr, -1, -1.0f), 0, &SvrsOnline); SvrsOnline.VSplitRight(TextRender()->TextWidth(0, 12.0f, aBufSvr, -1, -1.0f), 0, &SvrsOnline);
UI()->DoLabelScaled(&SvrsOnline, aBufSvr, 12.0f, TEXTALIGN_LEFT); UI()->DoLabel(&SvrsOnline, aBufSvr, 12.0f, TEXTALIGN_LEFT);
// status box // status box
{ {
@ -604,7 +604,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
ServerAddr.Margin(2.0f, &ServerAddr); ServerAddr.Margin(2.0f, &ServerAddr);
// address info // address info
UI()->DoLabelScaled(&ServerAddr, Localize("Server address:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&ServerAddr, Localize("Server address:"), 14.0f, TEXTALIGN_LEFT);
ServerAddr.VSplitLeft(SearchExcludeAddrStrMax + 5.0f + ExcludeSearchIconMax + 5.0f, NULL, &ServerAddr); ServerAddr.VSplitLeft(SearchExcludeAddrStrMax + 5.0f + ExcludeSearchIconMax + 5.0f, NULL, &ServerAddr);
static int s_ClearButton = 0; static int s_ClearButton = 0;
static float s_Offset = 0.0f; static float s_Offset = 0.0f;
@ -681,7 +681,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
RenderTools()->DrawUIRect(&FilterHeader, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_T, 4.0f); 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); RenderTools()->DrawUIRect(&ServerFilter, ColorRGBA(0, 0, 0, 0.15f), CUI::CORNER_B, 4.0f);
UI()->DoLabelScaled(&FilterHeader, Localize("Server filter"), FontSize + 2.0f, TEXTALIGN_CENTER); UI()->DoLabel(&FilterHeader, Localize("Server filter"), FontSize + 2.0f, TEXTALIGN_CENTER);
CUIRect Button, Button2; CUIRect Button, Button2;
ServerFilter.VSplitLeft(5.0f, 0, &ServerFilter); ServerFilter.VSplitLeft(5.0f, 0, &ServerFilter);
@ -715,7 +715,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
ServerFilter.HSplitTop(5.0f, 0, &ServerFilter); ServerFilter.HSplitTop(5.0f, 0, &ServerFilter);
ServerFilter.HSplitTop(19.0f, &Button, &ServerFilter); ServerFilter.HSplitTop(19.0f, &Button, &ServerFilter);
UI()->DoLabelScaled(&Button, Localize("Game types:"), FontSize, TEXTALIGN_LEFT); UI()->DoLabel(&Button, Localize("Game types:"), FontSize, TEXTALIGN_LEFT);
Button.VSplitRight(60.0f, 0, &Button); Button.VSplitRight(60.0f, 0, &Button);
ServerFilter.HSplitTop(3.0f, 0, &ServerFilter); ServerFilter.HSplitTop(3.0f, 0, &ServerFilter);
static float s_OffsetGametype = 0.0f; static float s_OffsetGametype = 0.0f;
@ -725,7 +725,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
// server address // server address
ServerFilter.HSplitTop(3.0f, 0, &ServerFilter); ServerFilter.HSplitTop(3.0f, 0, &ServerFilter);
ServerFilter.HSplitTop(19.0f, &Button, &ServerFilter); ServerFilter.HSplitTop(19.0f, &Button, &ServerFilter);
UI()->DoLabelScaled(&Button, Localize("Server address:"), FontSize, TEXTALIGN_LEFT); UI()->DoLabel(&Button, Localize("Server address:"), FontSize, TEXTALIGN_LEFT);
Button.VSplitRight(60.0f, 0, &Button); Button.VSplitRight(60.0f, 0, &Button);
static float s_OffsetAddr = 0.0f; 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)) if(UIEx()->DoEditBox(&g_Config.m_BrFilterServerAddress, &Button, g_Config.m_BrFilterServerAddress, sizeof(g_Config.m_BrFilterServerAddress), FontSize, &s_OffsetAddr))
@ -903,7 +903,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
} }
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Active ? 1.0f : 0.2f); TextRender()->TextColor(1.0f, 1.0f, 1.0f, Active ? 1.0f : 0.2f);
UI()->DoLabelScaled(&Rect, pName, FontSize, TEXTALIGN_CENTER); UI()->DoLabel(&Rect, pName, FontSize, TEXTALIGN_CENTER);
TextRender()->TextColor(1.0, 1.0, 1.0, 1.0f); TextRender()->TextColor(1.0, 1.0, 1.0, 1.0f);
} }
} }
@ -1047,7 +1047,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
ServerDetails.HSplitTop(ms_ListheaderHeight, &ServerHeader, &ServerDetails); ServerDetails.HSplitTop(ms_ListheaderHeight, &ServerHeader, &ServerDetails);
RenderTools()->DrawUIRect(&ServerHeader, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_T, 4.0f); 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); RenderTools()->DrawUIRect(&ServerDetails, ColorRGBA(0, 0, 0, 0.15f), CUI::CORNER_B, 4.0f);
UI()->DoLabelScaled(&ServerHeader, Localize("Server details"), FontSize + 2.0f, TEXTALIGN_CENTER); UI()->DoLabel(&ServerHeader, Localize("Server details"), FontSize + 2.0f, TEXTALIGN_CENTER);
if(pSelectedServer) if(pSelectedServer)
{ {
@ -1104,7 +1104,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
for(auto &Label : s_aLabels) for(auto &Label : s_aLabels)
{ {
LeftColumn.HSplitTop(15.0f, &Row, &LeftColumn); LeftColumn.HSplitTop(15.0f, &Row, &LeftColumn);
UI()->DoLabelScaled(&Row, Localize(Label), FontSize, TEXTALIGN_LEFT); UI()->DoLabel(&Row, Localize(Label), FontSize, TEXTALIGN_LEFT);
} }
RightColumn.HSplitTop(15.0f, &Row, &RightColumn); RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
@ -1265,7 +1265,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
ServerFriends.HSplitTop(ms_ListheaderHeight, &FilterHeader, &ServerFriends); ServerFriends.HSplitTop(ms_ListheaderHeight, &FilterHeader, &ServerFriends);
RenderTools()->DrawUIRect(&FilterHeader, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_T, 4.0f); 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); RenderTools()->DrawUIRect(&ServerFriends, ColorRGBA(0, 0, 0, 0.15f), 0, 4.0f);
UI()->DoLabelScaled(&FilterHeader, Localize("Friends"), FontSize + 4.0f, TEXTALIGN_CENTER); UI()->DoLabel(&FilterHeader, Localize("Friends"), FontSize + 4.0f, TEXTALIGN_CENTER);
CUIRect Button, List; CUIRect Button, List;
ServerFriends.Margin(3.0f, &ServerFriends); ServerFriends.Margin(3.0f, &ServerFriends);
@ -1292,15 +1292,15 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
Item.m_Rect.VMargin(2.5f, &Item.m_Rect); Item.m_Rect.VMargin(2.5f, &Item.m_Rect);
Item.m_Rect.HSplitTop(12.0f, &Item.m_Rect, &Button); Item.m_Rect.HSplitTop(12.0f, &Item.m_Rect, &Button);
UI()->DoLabelScaled(&Item.m_Rect, Friend.m_pFriendInfo->m_aName, FontSize, TEXTALIGN_LEFT); UI()->DoLabel(&Item.m_Rect, Friend.m_pFriendInfo->m_aName, FontSize, TEXTALIGN_LEFT);
UI()->DoLabelScaled(&Button, Friend.m_pFriendInfo->m_aClan, FontSize, TEXTALIGN_LEFT); UI()->DoLabel(&Button, Friend.m_pFriendInfo->m_aClan, FontSize, TEXTALIGN_LEFT);
RenderTools()->DrawUIRect(&OnState, Friend.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); RenderTools()->DrawUIRect(&OnState, Friend.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.HMargin((OnState.h - FontSize) / 3, &OnState);
OnState.VMargin(5.0f, &OnState); OnState.VMargin(5.0f, &OnState);
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%i", Friend.m_NumFound); str_format(aBuf, sizeof(aBuf), "%i", Friend.m_NumFound);
UI()->DoLabelScaled(&OnState, aBuf, FontSize + 2, TEXTALIGN_RIGHT); UI()->DoLabel(&OnState, aBuf, FontSize + 2, TEXTALIGN_RIGHT);
} }
} }
@ -1351,7 +1351,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
ServerFriends.HSplitTop(19.0f, &Button, &ServerFriends); ServerFriends.HSplitTop(19.0f, &Button, &ServerFriends);
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Name")); str_format(aBuf, sizeof(aBuf), "%s:", Localize("Name"));
UI()->DoLabelScaled(&Button, aBuf, FontSize + 2, TEXTALIGN_LEFT); UI()->DoLabel(&Button, aBuf, FontSize + 2, TEXTALIGN_LEFT);
Button.VSplitLeft(80.0f, 0, &Button); Button.VSplitLeft(80.0f, 0, &Button);
static char s_aName[MAX_NAME_LENGTH] = {0}; static char s_aName[MAX_NAME_LENGTH] = {0};
static float s_OffsetName = 0.0f; static float s_OffsetName = 0.0f;
@ -1360,7 +1360,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
ServerFriends.HSplitTop(3.0f, 0, &ServerFriends); ServerFriends.HSplitTop(3.0f, 0, &ServerFriends);
ServerFriends.HSplitTop(19.0f, &Button, &ServerFriends); ServerFriends.HSplitTop(19.0f, &Button, &ServerFriends);
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Clan")); str_format(aBuf, sizeof(aBuf), "%s:", Localize("Clan"));
UI()->DoLabelScaled(&Button, aBuf, FontSize + 2, TEXTALIGN_LEFT); UI()->DoLabel(&Button, aBuf, FontSize + 2, TEXTALIGN_LEFT);
Button.VSplitLeft(80.0f, 0, &Button); Button.VSplitLeft(80.0f, 0, &Button);
static char s_aClan[MAX_CLAN_LENGTH] = {0}; static char s_aClan[MAX_CLAN_LENGTH] = {0};
static float s_OffsetClan = 0.0f; static float s_OffsetClan = 0.0f;

View file

@ -83,19 +83,19 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
CUIRect Screen = *UI()->Screen(); CUIRect Screen = *UI()->Screen();
CUIRect Box, Part, Part2; CUIRect Box, Part, Part2;
Box = Screen; Box = Screen;
Box.Margin(150.0f / UI()->Scale(), &Box); Box.Margin(150.0f, &Box);
// render the box // render the box
RenderTools()->DrawUIRect(&Box, ColorRGBA(0, 0, 0, 0.5f), CUI::CORNER_ALL, 15.0f); RenderTools()->DrawUIRect(&Box, ColorRGBA(0, 0, 0, 0.5f), CUI::CORNER_ALL, 15.0f);
Box.HSplitTop(20.f / UI()->Scale(), 0, &Box); Box.HSplitTop(20.f, 0, &Box);
Box.HSplitTop(24.f / UI()->Scale(), &Part, &Box); Box.HSplitTop(24.f, &Part, &Box);
UI()->DoLabelScaled(&Part, Localize("Select a name"), 24.f, TEXTALIGN_CENTER); UI()->DoLabel(&Part, Localize("Select a name"), 24.f, TEXTALIGN_CENTER);
Box.HSplitTop(20.f / UI()->Scale(), 0, &Box); Box.HSplitTop(20.f, 0, &Box);
Box.HSplitTop(20.f / UI()->Scale(), &Part, &Box); Box.HSplitTop(20.f, &Part, &Box);
Part.VMargin(20.f / UI()->Scale(), &Part); Part.VMargin(20.f, &Part);
UI()->DoLabelScaled(&Part, m_aDemoPlayerPopupHint, 20.f, TEXTALIGN_CENTER); UI()->DoLabel(&Part, m_aDemoPlayerPopupHint, 20.f, TEXTALIGN_CENTER);
Box.HSplitTop(20.f / UI()->Scale(), 0, &Box); Box.HSplitTop(20.f, 0, &Box);
CUIRect Label, TextBox, Ok, Abort; CUIRect Label, TextBox, Ok, Abort;
@ -158,7 +158,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
Label.VSplitLeft(120.0f, 0, &TextBox); Label.VSplitLeft(120.0f, 0, &TextBox);
TextBox.VSplitLeft(20.0f, 0, &TextBox); TextBox.VSplitLeft(20.0f, 0, &TextBox);
TextBox.VSplitRight(60.0f, &TextBox, 0); TextBox.VSplitRight(60.0f, &TextBox, 0);
UI()->DoLabelScaled(&Label, Localize("New name:"), 18.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("New name:"), 18.0f, TEXTALIGN_LEFT);
static float s_Offset = 0.0f; static float s_Offset = 0.0f;
if(UIEx()->DoEditBox(&s_Offset, &TextBox, m_aCurrentDemoFile, sizeof(m_aCurrentDemoFile), 12.0f, &s_Offset)) if(UIEx()->DoEditBox(&s_Offset, &TextBox, m_aCurrentDemoFile, sizeof(m_aCurrentDemoFile), 12.0f, &s_Offset))
{ {
@ -579,7 +579,7 @@ CMenus::CListboxItem CMenus::UiDoListboxNextRow()
if(gs_ListBoxItemIndex % gs_ListBoxItemsPerRow == 0) if(gs_ListBoxItemIndex % gs_ListBoxItemsPerRow == 0)
gs_ListBoxView.HSplitTop(gs_ListBoxRowHeight /*-2.0f*/, &s_RowView, &gs_ListBoxView); gs_ListBoxView.HSplitTop(gs_ListBoxRowHeight /*-2.0f*/, &s_RowView, &gs_ListBoxView);
s_RowView.VSplitLeft(s_RowView.w / (gs_ListBoxItemsPerRow - gs_ListBoxItemIndex % gs_ListBoxItemsPerRow) / (UI()->Scale()), &Item.m_Rect, &s_RowView); s_RowView.VSplitLeft(s_RowView.w / (gs_ListBoxItemsPerRow - gs_ListBoxItemIndex % gs_ListBoxItemsPerRow), &Item.m_Rect, &s_RowView);
Item.m_Visible = 1; Item.m_Visible = 1;
//item.rect = row; //item.rect = row;
@ -911,76 +911,76 @@ void CMenus::RenderDemoList(CUIRect MainView)
// left side // left side
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Created:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Created:"), 14.0f, TEXTALIGN_LEFT);
char aTimestamp[256]; char aTimestamp[256];
str_timestamp_ex(m_vDemos[m_DemolistSelectedIndex].m_Date, aTimestamp, sizeof(aTimestamp), FORMAT_SPACE); str_timestamp_ex(m_vDemos[m_DemolistSelectedIndex].m_Date, aTimestamp, sizeof(aTimestamp), FORMAT_SPACE);
UI()->DoLabelScaled(&Right, aTimestamp, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, aTimestamp, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels); Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Type:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Type:"), 14.0f, TEXTALIGN_LEFT);
UI()->DoLabelScaled(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aType, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aType, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels); Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Length:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Length:"), 14.0f, TEXTALIGN_LEFT);
int Length = m_vDemos[m_DemolistSelectedIndex].Length(); int Length = m_vDemos[m_DemolistSelectedIndex].Length();
char aBuf[64]; char aBuf[64];
str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf)); str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf));
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels); Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Version:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Version:"), 14.0f, TEXTALIGN_LEFT);
str_format(aBuf, sizeof(aBuf), "%d", m_vDemos[m_DemolistSelectedIndex].m_Info.m_Version); str_format(aBuf, sizeof(aBuf), "%d", m_vDemos[m_DemolistSelectedIndex].m_Info.m_Version);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels); Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Markers:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Markers:"), 14.0f, TEXTALIGN_LEFT);
str_format(aBuf, sizeof(aBuf), "%d", m_vDemos[m_DemolistSelectedIndex].NumMarkers()); str_format(aBuf, sizeof(aBuf), "%d", m_vDemos[m_DemolistSelectedIndex].NumMarkers());
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
// right side // right side
Labels = MainView; Labels = MainView;
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Map:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Map:"), 14.0f, TEXTALIGN_LEFT);
UI()->DoLabelScaled(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aMapName, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aMapName, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels); Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Size:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Size:"), 14.0f, TEXTALIGN_LEFT);
const float Size = m_vDemos[m_DemolistSelectedIndex].Size() / 1024.0f; const float Size = m_vDemos[m_DemolistSelectedIndex].Size() / 1024.0f;
if(Size > 1024) if(Size > 1024)
str_format(aBuf, sizeof(aBuf), Localize("%.2f MiB"), Size / 1024.0f); str_format(aBuf, sizeof(aBuf), Localize("%.2f MiB"), Size / 1024.0f);
else else
str_format(aBuf, sizeof(aBuf), Localize("%.2f KiB"), Size); str_format(aBuf, sizeof(aBuf), Localize("%.2f KiB"), Size);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
Labels.HSplitTop(5.0f, 0, &Labels); Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
if(m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256 != SHA256_ZEROED) if(m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256 != SHA256_ZEROED)
{ {
UI()->DoLabelScaled(&Left, "SHA256:", 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, "SHA256:", 14.0f, TEXTALIGN_LEFT);
char aSha[SHA256_MAXSTRSIZE]; char aSha[SHA256_MAXSTRSIZE];
sha256_str(m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256, aSha, sizeof(aSha) / 2); sha256_str(m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256, aSha, sizeof(aSha) / 2);
UI()->DoLabelScaled(&Right, aSha, Right.w > 235 ? 14.0f : 11.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, aSha, Right.w > 235 ? 14.0f : 11.0f, TEXTALIGN_LEFT);
} }
else else
{ {
UI()->DoLabelScaled(&Left, Localize("Crc:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Crc:"), 14.0f, TEXTALIGN_LEFT);
str_format(aBuf, sizeof(aBuf), "%08x", m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Crc); str_format(aBuf, sizeof(aBuf), "%08x", m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Crc);
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
} }
Labels.HSplitTop(5.0f, 0, &Labels); Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right); Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabelScaled(&Left, Localize("Netversion:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Left, Localize("Netversion:"), 14.0f, TEXTALIGN_LEFT);
UI()->DoLabelScaled(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aNetversion, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aNetversion, 14.0f, TEXTALIGN_LEFT);
} }
// demo list // demo list
@ -1157,7 +1157,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
else if(ID == COL_DEMONAME) else if(ID == COL_DEMONAME)
{ {
CTextCursor Cursor; CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f * UI()->Scale()) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END); TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f) / 2.f, 12.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w; Cursor.m_LineWidth = Button.w;
TextRender()->TextEx(&Cursor, Item.m_aName, -1); TextRender()->TextEx(&Cursor, Item.m_aName, -1);
@ -1167,7 +1167,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
char aBuf[3]; char aBuf[3];
str_format(aBuf, sizeof(aBuf), "%d", Item.NumMarkers()); str_format(aBuf, sizeof(aBuf), "%d", Item.NumMarkers());
Button.VMargin(4.0f, &Button); Button.VMargin(4.0f, &Button);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT); UI()->DoLabel(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT);
} }
else if(ID == COL_LENGTH && !Item.m_IsDir && Item.m_InfosLoaded) else if(ID == COL_LENGTH && !Item.m_IsDir && Item.m_InfosLoaded)
{ {
@ -1175,14 +1175,14 @@ void CMenus::RenderDemoList(CUIRect MainView)
char aBuf[32]; char aBuf[32];
str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf)); str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf));
Button.VMargin(4.0f, &Button); Button.VMargin(4.0f, &Button);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT); UI()->DoLabel(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT);
} }
else if(ID == COL_DATE && !Item.m_IsDir) else if(ID == COL_DATE && !Item.m_IsDir)
{ {
char aBuf[64]; char aBuf[64];
str_timestamp_ex(Item.m_Date, aBuf, sizeof(aBuf), FORMAT_SPACE); str_timestamp_ex(Item.m_Date, aBuf, sizeof(aBuf), FORMAT_SPACE);
Button.VSplitRight(24.0f, &Button, 0); Button.VSplitRight(24.0f, &Button, 0);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT); UI()->DoLabel(&Button, aBuf, 12.0f, TEXTALIGN_RIGHT);
} }
} }
} }
@ -1297,5 +1297,5 @@ void CMenus::RenderDemoList(CUIRect MainView)
#endif #endif
} }
UI()->DoLabelScaled(&LabelRect, aFooterLabel, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); RenderTools()->DrawUIRect(&Options, ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f);
Options.Margin(10.0f, &Options); Options.Margin(10.0f, &Options);
Options.HSplitTop(50.0f, &Button, &Options); Options.HSplitTop(50.0f, &Button, &Options);
UI()->DoLabelScaled(&Button, Localize("Player options"), 34.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Button, Localize("Player options"), 34.0f, TEXTALIGN_LEFT);
// headline // headline
Options.HSplitTop(34.0f, &ButtonBar, &Options); Options.HSplitTop(34.0f, &ButtonBar, &Options);
ButtonBar.VSplitRight(231.0f, &Player, &ButtonBar); ButtonBar.VSplitRight(231.0f, &Player, &ButtonBar);
UI()->DoLabelScaled(&Player, Localize("Player"), 24.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Player, Localize("Player"), 24.0f, TEXTALIGN_LEFT);
ButtonBar.HMargin(1.0f, &ButtonBar); ButtonBar.HMargin(1.0f, &ButtonBar);
float Width = ButtonBar.h * 2.0f; float Width = ButtonBar.h * 2.0f;
@ -386,8 +386,8 @@ void CMenus::RenderServerInfo(CUIRect MainView)
MainView.Margin(10.0f, &View); MainView.Margin(10.0f, &View);
// serverinfo // serverinfo
View.HSplitTop(View.h / 2 / UI()->Scale() - 5.0f, &ServerInfo, &Motd); View.HSplitTop(View.h / 2 - 5.0f, &ServerInfo, &Motd);
ServerInfo.VSplitLeft(View.w / 2 / UI()->Scale() - 5.0f, &ServerInfo, &GameInfo); ServerInfo.VSplitLeft(View.w / 2 - 5.0f, &ServerInfo, &GameInfo);
RenderTools()->DrawUIRect(&ServerInfo, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->DrawUIRect(&ServerInfo, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
ServerInfo.Margin(5.0f, &ServerInfo); ServerInfo.Margin(5.0f, &ServerInfo);
@ -503,7 +503,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
CListboxItem Item = UiDoListboxNextItem(pOption); CListboxItem Item = UiDoListboxNextItem(pOption);
if(Item.m_Visible) if(Item.m_Visible)
UI()->DoLabelScaled(&Item.m_Rect, pOption->m_aDescription, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Item.m_Rect, pOption->m_aDescription, 13.0f, TEXTALIGN_LEFT);
if(NumVoteOptions < Total) if(NumVoteOptions < Total)
aIndices[NumVoteOptions] = i; aIndices[NumVoteOptions] = i;
@ -561,7 +561,7 @@ bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_NORMAL, vec2(1.0f, 0.0f), TeeRenderPos); RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_NORMAL, vec2(1.0f, 0.0f), TeeRenderPos);
Item.m_Rect.x += TeeInfo.m_Size; Item.m_Rect.x += TeeInfo.m_Size;
UI()->DoLabelScaled(&Item.m_Rect, m_pClient->m_aClients[aPlayerIDs[i]].m_aName, 16.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Item.m_Rect, m_pClient->m_aClients[aPlayerIDs[i]].m_aName, 16.0f, TEXTALIGN_LEFT);
} }
} }
@ -629,7 +629,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
SLabelProperties Props; SLabelProperties Props;
Props.m_AlignVertically = 0; Props.m_AlignVertically = 0;
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, Props); UI()->DoLabel(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, Props);
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f); float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f);
TextRender()->SetRenderFlags(0); TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL); TextRender()->SetCurFont(NULL);
@ -687,7 +687,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
Bottom.VSplitRight(160.0f, &Bottom, &Reason); Bottom.VSplitRight(160.0f, &Bottom, &Reason);
Reason.HSplitTop(5.0f, 0, &Reason); Reason.HSplitTop(5.0f, 0, &Reason);
const char *pLabel = Localize("Reason:"); const char *pLabel = Localize("Reason:");
UI()->DoLabelScaled(&Reason, pLabel, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Reason, pLabel, 14.0f, TEXTALIGN_LEFT);
float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1, -1.0f); float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1, -1.0f);
Reason.VSplitLeft(w + 10.0f, 0, &Reason); Reason.VSplitLeft(w + 10.0f, 0, &Reason);
static float s_Offset = 0.0f; static float s_Offset = 0.0f;
@ -746,10 +746,10 @@ void CMenus::RenderServerControl(CUIRect MainView)
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension); RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
Bottom.VSplitLeft(5.0f, 0, &Bottom); Bottom.VSplitLeft(5.0f, 0, &Bottom);
Bottom.VSplitLeft(250.0f, &Button, &Bottom); Bottom.VSplitLeft(250.0f, &Button, &Bottom);
UI()->DoLabelScaled(&Button, Localize("Vote description:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Button, Localize("Vote description:"), 14.0f, TEXTALIGN_LEFT);
Bottom.VSplitLeft(20.0f, 0, &Button); Bottom.VSplitLeft(20.0f, 0, &Button);
UI()->DoLabelScaled(&Button, Localize("Vote command:"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Button, Localize("Vote command:"), 14.0f, TEXTALIGN_LEFT);
static char s_aVoteDescription[64] = {0}; static char s_aVoteDescription[64] = {0};
static char s_aVoteCommand[512] = {0}; static char s_aVoteCommand[512] = {0};
@ -1068,7 +1068,7 @@ void CMenus::RenderGhost(CUIRect MainView)
else if(Id == COL_NAME) else if(Id == COL_NAME)
{ {
CTextCursor Cursor; CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f * UI()->Scale()) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END); TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f) / 2.f, 12.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w; Cursor.m_LineWidth = Button.w;
TextRender()->TextEx(&Cursor, pItem->m_aPlayer, -1); TextRender()->TextEx(&Cursor, pItem->m_aPlayer, -1);
@ -1076,7 +1076,7 @@ void CMenus::RenderGhost(CUIRect MainView)
else if(Id == COL_TIME) else if(Id == COL_TIME)
{ {
CTextCursor Cursor; CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f * UI()->Scale()) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END); TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f) / 2.f, 12.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w; Cursor.m_LineWidth = Button.w;
char aBuf[64]; char aBuf[64];

View file

@ -77,7 +77,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
{ {
// headline // headline
Game.HSplitTop(20.0f, &Label, &Game); Game.HSplitTop(20.0f, &Label, &Game);
UI()->DoLabelScaled(&Label, Localize("Game"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Game"), 20.0f, TEXTALIGN_LEFT);
Game.Margin(5.0f, &Game); Game.Margin(5.0f, &Game);
Game.VSplitMid(&Left, &Right); Game.VSplitMid(&Left, &Right);
Left.VSplitRight(5.0f, &Left, 0); Left.VSplitRight(5.0f, &Left, 0);
@ -148,7 +148,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
Right.HSplitTop(20.0f, &Label, &Right); Right.HSplitTop(20.0f, &Label, &Right);
Right.HSplitTop(20.0f, &Button, &Right); Right.HSplitTop(20.0f, &Button, &Right);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Name plates size"), g_Config.m_ClNameplatesSize); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Name plates size"), g_Config.m_ClNameplatesSize);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); 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); Right.HSplitTop(20.0f, &Button, &Right);
@ -166,7 +166,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
Right.HSplitTop(20.0f, &Label, &Right); Right.HSplitTop(20.0f, &Label, &Right);
Right.HSplitTop(20.0f, &Button, &Right); Right.HSplitTop(20.0f, &Button, &Right);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Clan plates size"), g_Config.m_ClNameplatesClanSize); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Clan plates size"), g_Config.m_ClNameplatesClanSize);
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); g_Config.m_ClNameplatesClanSize = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClNameplatesClanSize, &Button, g_Config.m_ClNameplatesClanSize / 100.0f) * 100.0f + 0.1f);
} }
} }
@ -176,7 +176,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
{ {
// headline // headline
Client.HSplitTop(20.0f, &Label, &Client); Client.HSplitTop(20.0f, &Label, &Client);
UI()->DoLabelScaled(&Label, Localize("Client"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Client"), 20.0f, TEXTALIGN_LEFT);
Client.Margin(5.0f, &Client); Client.Margin(5.0f, &Client);
Client.VSplitMid(&Left, &Right); Client.VSplitMid(&Left, &Right);
Left.VSplitRight(5.0f, &Left, 0); Left.VSplitRight(5.0f, &Left, 0);
@ -202,7 +202,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max demos"), g_Config.m_ClAutoDemoMax); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max demos"), g_Config.m_ClAutoDemoMax);
else else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max demos"), ""); str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max demos"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right); 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); g_Config.m_ClAutoDemoMax = static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoDemoMax, &Button, g_Config.m_ClAutoDemoMax / 1000.0f) * 1000.0f + 0.1f);
@ -216,7 +216,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoScreenshotMax); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoScreenshotMax);
else else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), ""); str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right); 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); g_Config.m_ClAutoScreenshotMax = static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax / 1000.0f) * 1000.0f + 0.1f);
} }
@ -227,7 +227,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i Hz", Localize("Refresh Rate"), g_Config.m_ClRefreshRate); str_format(aBuf, sizeof(aBuf), "%s: %i Hz", Localize("Refresh Rate"), g_Config.m_ClRefreshRate);
else else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Refresh Rate"), ""); str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Refresh Rate"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Left.HSplitTop(20.0f, &Button, &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); g_Config.m_ClRefreshRate = static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClRefreshRate, &Button, g_Config.m_ClRefreshRate / 10000.0f) * 10000.0f + 0.1f);
@ -294,7 +294,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoStatboardScreenshotMax); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoStatboardScreenshotMax);
else else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), ""); str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right); Right.HSplitTop(20.0f, &Button, &Right);
g_Config.m_ClAutoStatboardScreenshotMax = g_Config.m_ClAutoStatboardScreenshotMax =
static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoStatboardScreenshotMax, static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoStatboardScreenshotMax,
@ -320,7 +320,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max CSVs"), g_Config.m_ClAutoCSVMax); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max CSVs"), g_Config.m_ClAutoCSVMax);
else else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max CSVs"), ""); str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max CSVs"), "");
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right); Right.HSplitTop(20.0f, &Button, &Right);
g_Config.m_ClAutoCSVMax = g_Config.m_ClAutoCSVMax =
static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoCSVMax, static_cast<int>(UIEx()->DoScrollbarH(&g_Config.m_ClAutoCSVMax,
@ -364,7 +364,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Button.VSplitLeft(150.0f, &Button, 0); Button.VSplitLeft(150.0f, &Button, 0);
char aBuf[128]; char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Name")); str_format(aBuf, sizeof(aBuf), "%s:", Localize("Name"));
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
static float s_OffsetName = 0.0f; static float s_OffsetName = 0.0f;
SUIExEditBoxProperties EditProps; SUIExEditBoxProperties EditProps;
EditProps.m_pEmptyText = pNameFallback; EditProps.m_pEmptyText = pNameFallback;
@ -380,7 +380,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Button.VSplitLeft(200.0f, &Button, &Dummy); Button.VSplitLeft(200.0f, &Button, &Dummy);
Button.VSplitLeft(150.0f, &Button, 0); Button.VSplitLeft(150.0f, &Button, 0);
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Clan")); str_format(aBuf, sizeof(aBuf), "%s:", Localize("Clan"));
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
static float s_OffsetClan = 0.0f; static float s_OffsetClan = 0.0f;
if(UIEx()->DoEditBox(pClan, &Button, pClan, sizeof(g_Config.m_PlayerClan), 14.0f, &s_OffsetClan)) if(UIEx()->DoEditBox(pClan, &Button, pClan, sizeof(g_Config.m_PlayerClan), 14.0f, &s_OffsetClan))
{ {
@ -488,7 +488,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
OwnSkinInfo.m_ColorBody = ColorRGBA(1.0f, 1.0f, 1.0f); OwnSkinInfo.m_ColorBody = ColorRGBA(1.0f, 1.0f, 1.0f);
OwnSkinInfo.m_ColorFeet = ColorRGBA(1.0f, 1.0f, 1.0f); OwnSkinInfo.m_ColorFeet = ColorRGBA(1.0f, 1.0f, 1.0f);
} }
OwnSkinInfo.m_Size = 50.0f * UI()->Scale(); OwnSkinInfo.m_Size = 50.0f;
MainView.HSplitTop(20.0f, &Label, &MainView); MainView.HSplitTop(20.0f, &Label, &MainView);
Label.VSplitLeft(280.0f, &Label, &Dummy); Label.VSplitLeft(280.0f, &Label, &Dummy);
@ -497,7 +497,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
SkinPrefix.VSplitLeft(120.0f, &SkinPrefix, &EyesRight); SkinPrefix.VSplitLeft(120.0f, &SkinPrefix, &EyesRight);
char aBuf[128 + IO_MAX_PATH_LENGTH]; char aBuf[128 + IO_MAX_PATH_LENGTH];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Your skin")); str_format(aBuf, sizeof(aBuf), "%s:", Localize("Your skin"));
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy); Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);
@ -530,7 +530,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
} }
SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix); SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix);
UI()->DoLabelScaled(&SkinPrefixLabel, Localize("Skin prefix"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&SkinPrefixLabel, Localize("Skin prefix"), 14.0f, TEXTALIGN_LEFT);
SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix); SkinPrefix.HSplitTop(20.0f, &SkinPrefixLabel, &SkinPrefix);
{ {
@ -650,7 +650,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
for(int i = 0; i < 2; i++) for(int i = 0; i < 2; i++)
{ {
aRects[i].HSplitTop(20.0f, &Label, &aRects[i]); aRects[i].HSplitTop(20.0f, &Label, &aRects[i]);
UI()->DoLabelScaled(&Label, paParts[i], 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, paParts[i], 14.0f, TEXTALIGN_LEFT);
aRects[i].VSplitLeft(10.0f, 0, &aRects[i]); aRects[i].VSplitLeft(10.0f, 0, &aRects[i]);
aRects[i].HSplitTop(2.5f, 0, &aRects[i]); aRects[i].HSplitTop(2.5f, 0, &aRects[i]);
@ -725,7 +725,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
Item.m_Rect.VSplitLeft(60.0f, 0, &Item.m_Rect); Item.m_Rect.VSplitLeft(60.0f, 0, &Item.m_Rect);
SLabelProperties Props; SLabelProperties Props;
Props.m_MaxWidth = Item.m_Rect.w; Props.m_MaxWidth = Item.m_Rect.w;
UI()->DoLabelScaled(&Item.m_Rect, s->m_aName, 12.0f, TEXTALIGN_LEFT, Props); UI()->DoLabel(&Item.m_Rect, s->m_aName, 12.0f, TEXTALIGN_LEFT, Props);
if(g_Config.m_Debug) if(g_Config.m_Debug)
{ {
ColorRGBA BloodColor = *UseCustomColor ? color_cast<ColorRGBA>(ColorHSLA(*ColorBody)) : s->m_BloodColor; ColorRGBA BloodColor = *UseCustomColor ? color_cast<ColorRGBA>(ColorHSLA(*ColorBody)) : s->m_BloodColor;
@ -757,7 +757,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
SLabelProperties Props; SLabelProperties Props;
Props.m_AlignVertically = 0; Props.m_AlignVertically = 0;
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, Props); UI()->DoLabel(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, Props);
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f); float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f);
TextRender()->SetRenderFlags(0); TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL); TextRender()->SetCurFont(NULL);
@ -916,7 +916,7 @@ void CMenus::DoSettingsControlsButtons(int Start, int Stop, CUIRect View, CUIRec
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_Name)); str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_Name));
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination; int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination;
int NewId = DoKeyReader((void *)&Key.m_Name, &Button, OldId, OldModifierCombination, &NewModifierCombination); int NewId = DoKeyReader((void *)&Key.m_Name, &Button, OldId, OldModifierCombination, &NewModifierCombination);
if(NewId != OldId || NewModifierCombination != OldModifierCombination) if(NewId != OldId || NewModifierCombination != OldModifierCombination)
@ -978,7 +978,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
RenderTools()->DrawUIRect(&MovementSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->DrawUIRect(&MovementSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
MovementSettings.VMargin(10.0f, &MovementSettings); MovementSettings.VMargin(10.0f, &MovementSettings);
TextRender()->Text(0, MovementSettings.x, MovementSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Movement"), -1.0f); TextRender()->Text(0, MovementSettings.x, MovementSettings.y + (14.0f + 5.0f + 10.0f - 14.0f) / 2.f, 14.0f, Localize("Movement"), -1.0f);
MovementSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &MovementSettings); MovementSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &MovementSettings);
@ -987,7 +987,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
MovementSettings.HSplitTop(20.0f, &Button, &MovementSettings); MovementSettings.HSplitTop(20.0f, &Button, &MovementSettings);
Button.VSplitLeft(160.0f, &Label, &Button); Button.VSplitLeft(160.0f, &Label, &Button);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Mouse sens."), g_Config.m_InpMousesens); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Mouse sens."), g_Config.m_InpMousesens);
UI()->DoLabel(&Label, aBuf, 14.0f * UI()->Scale(), TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
int NewValue = (int)(UIEx()->DoScrollbarH(&g_Config.m_InpMousesens, &Button, (minimum(g_Config.m_InpMousesens, 500) - 1) / 500.0f) * 500.0f) + 1; 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) if(g_Config.m_InpMousesens < 500 || NewValue < 500)
g_Config.m_InpMousesens = minimum(NewValue, 500); g_Config.m_InpMousesens = minimum(NewValue, 500);
@ -999,7 +999,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
MovementSettings.HSplitTop(20.0f, &Button, &MovementSettings); MovementSettings.HSplitTop(20.0f, &Button, &MovementSettings);
Button.VSplitLeft(160.0f, &Label, &Button); Button.VSplitLeft(160.0f, &Label, &Button);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("UI mouse s."), g_Config.m_UiMousesens); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("UI mouse s."), g_Config.m_UiMousesens);
UI()->DoLabel(&Label, aBuf, 14.0f * UI()->Scale(), TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
int NewValue = (int)(UIEx()->DoScrollbarH(&g_Config.m_UiMousesens, &Button, (minimum(g_Config.m_UiMousesens, 500) - 1) / 500.0f) * 500.0f) + 1; 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) if(g_Config.m_UiMousesens < 500 || NewValue < 500)
g_Config.m_UiMousesens = minimum(NewValue, 500); g_Config.m_UiMousesens = minimum(NewValue, 500);
@ -1016,7 +1016,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
RenderTools()->DrawUIRect(&WeaponSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->DrawUIRect(&WeaponSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
WeaponSettings.VMargin(10.0f, &WeaponSettings); WeaponSettings.VMargin(10.0f, &WeaponSettings);
TextRender()->Text(0, WeaponSettings.x, WeaponSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Weapon"), -1.0f); TextRender()->Text(0, WeaponSettings.x, WeaponSettings.y + (14.0f + 5.0f + 10.0f - 14.0f) / 2.f, 14.0f, Localize("Weapon"), -1.0f);
WeaponSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &WeaponSettings); WeaponSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &WeaponSettings);
DoSettingsControlsButtons(15, 22, WeaponSettings, MainView); DoSettingsControlsButtons(15, 22, WeaponSettings, MainView);
@ -1042,7 +1042,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
RenderTools()->DrawUIRect(&VotingSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->DrawUIRect(&VotingSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
VotingSettings.VMargin(10.0f, &VotingSettings); VotingSettings.VMargin(10.0f, &VotingSettings);
TextRender()->Text(0, VotingSettings.x, VotingSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Voting"), -1.0f); TextRender()->Text(0, VotingSettings.x, VotingSettings.y + (14.0f + 5.0f + 10.0f - 14.0f) / 2.f, 14.0f, Localize("Voting"), -1.0f);
VotingSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &VotingSettings); VotingSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &VotingSettings);
DoSettingsControlsButtons(22, 24, VotingSettings, MainView); DoSettingsControlsButtons(22, 24, VotingSettings, MainView);
@ -1055,7 +1055,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
RenderTools()->DrawUIRect(&ChatSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->DrawUIRect(&ChatSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
ChatSettings.VMargin(10.0f, &ChatSettings); ChatSettings.VMargin(10.0f, &ChatSettings);
TextRender()->Text(0, ChatSettings.x, ChatSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Chat"), -1.0f); TextRender()->Text(0, ChatSettings.x, ChatSettings.y + (14.0f + 5.0f + 10.0f - 14.0f) / 2.f, 14.0f, Localize("Chat"), -1.0f);
ChatSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &ChatSettings); ChatSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &ChatSettings);
DoSettingsControlsButtons(24, 29, ChatSettings, MainView); DoSettingsControlsButtons(24, 29, ChatSettings, MainView);
@ -1068,7 +1068,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
RenderTools()->DrawUIRect(&DummySettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->DrawUIRect(&DummySettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
DummySettings.VMargin(10.0f, &DummySettings); DummySettings.VMargin(10.0f, &DummySettings);
TextRender()->Text(0, DummySettings.x, DummySettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Dummy"), -1.0f); TextRender()->Text(0, DummySettings.x, DummySettings.y + (14.0f + 5.0f + 10.0f - 14.0f) / 2.f, 14.0f, Localize("Dummy"), -1.0f);
DummySettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &DummySettings); DummySettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &DummySettings);
DoSettingsControlsButtons(29, 32, DummySettings, MainView); DoSettingsControlsButtons(29, 32, DummySettings, MainView);
@ -1081,7 +1081,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
RenderTools()->DrawUIRect(&MiscSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->DrawUIRect(&MiscSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
MiscSettings.VMargin(10.0f, &MiscSettings); MiscSettings.VMargin(10.0f, &MiscSettings);
TextRender()->Text(0, MiscSettings.x, MiscSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Miscellaneous"), -1.0f); TextRender()->Text(0, MiscSettings.x, MiscSettings.y + (14.0f + 5.0f + 10.0f - 14.0f) / 2.f, 14.0f, Localize("Miscellaneous"), -1.0f);
MiscSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &MiscSettings); MiscSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &MiscSettings);
DoSettingsControlsButtons(32, 44, MiscSettings, MainView); DoSettingsControlsButtons(32, 44, MiscSettings, MainView);
@ -1104,7 +1104,7 @@ int CMenus::RenderDropDown(int &CurDropDownState, CUIRect *pRect, int CurSelecti
if(Item.m_Visible) if(Item.m_Visible)
{ {
str_format(aBuf, sizeof(aBuf), "%s", pStr[i]); str_format(aBuf, sizeof(aBuf), "%s", pStr[i]);
UI()->DoLabelScaled(&Item.m_Rect, aBuf, 16.0f, TEXTALIGN_CENTER); UI()->DoLabel(&Item.m_Rect, aBuf, 16.0f, TEXTALIGN_CENTER);
} }
} }
bool ClickedItem = false; bool ClickedItem = false;
@ -1129,7 +1129,7 @@ int CMenus::RenderDropDown(int &CurDropDownState, CUIRect *pRect, int CurSelecti
DropDownIcon.VSplitRight(5.0f, &DropDownIcon, nullptr); DropDownIcon.VSplitRight(5.0f, &DropDownIcon, nullptr);
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT)); 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); 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(&DropDownIcon, "\xEF\x84\xBA", DropDownIcon.h * CUI::ms_FontmodHeight, TEXTALIGN_RIGHT); UI()->DoLabel(&DropDownIcon, "\xEF\x84\xBA", DropDownIcon.h * CUI::ms_FontmodHeight, TEXTALIGN_RIGHT);
TextRender()->SetRenderFlags(0); TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL); TextRender()->SetCurFont(NULL);
return CurSelection; return CurSelection;
@ -1187,7 +1187,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
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); 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, TEXTALIGN_CENTER); UI()->DoLabel(&ModeLabel, aBuf, sc_FontSizeResListHeader, TEXTALIGN_CENTER);
UiDoListboxStart(&s_NumNodes, &ModeList, sc_RowHeightResList, Localize("Display Modes"), aBuf, s_NumNodes - 1, 1, OldSelected, s_ScrollValue); 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) for(int i = 0; i < s_NumNodes; ++i)
@ -1206,7 +1206,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
{ {
int G = std::gcd(s_aModes[i].m_CanvasWidth, s_aModes[i].m_CanvasHeight); int G = std::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); 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, TEXTALIGN_LEFT); UI()->DoLabel(&Item.m_Rect, aBuf, sc_FontSizeResList, TEXTALIGN_LEFT);
} }
} }
@ -1333,7 +1333,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i Hz", Localize("Refresh Rate"), g_Config.m_GfxRefreshRate); str_format(aBuf, sizeof(aBuf), "%s: %i Hz", Localize("Refresh Rate"), g_Config.m_GfxRefreshRate);
else else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Refresh Rate"), ""); str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Refresh Rate"), "");
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); 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) if(g_Config.m_GfxRefreshRate <= 1000 || NewRefreshRate < 1000)
g_Config.m_GfxRefreshRate = NewRefreshRate; g_Config.m_GfxRefreshRate = NewRefreshRate;
@ -1342,7 +1342,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
MainView.HSplitTop(20.0f, 0, &MainView); MainView.HSplitTop(20.0f, 0, &MainView);
MainView.HSplitTop(20.0f, &Text, &MainView); MainView.HSplitTop(20.0f, &Text, &MainView);
//text.VSplitLeft(15.0f, 0, &text); //text.VSplitLeft(15.0f, 0, &text);
UI()->DoLabelScaled(&Text, Localize("UI Color"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Text, Localize("UI Color"), 14.0f, TEXTALIGN_LEFT);
CUIRect HSLBar = MainView; CUIRect HSLBar = MainView;
RenderHSLScrollbars(&HSLBar, &g_Config.m_UiColor, true); RenderHSLScrollbars(&HSLBar, &g_Config.m_UiColor, true);
MainView.y = HSLBar.y; MainView.y = HSLBar.y;
@ -1382,7 +1382,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
{ {
MainView.HSplitTop(10.0f, nullptr, &MainView); MainView.HSplitTop(10.0f, nullptr, &MainView);
MainView.HSplitTop(20.0f, &Text, &MainView); MainView.HSplitTop(20.0f, &Text, &MainView);
UI()->DoLabelScaled(&Text, Localize("Renderer"), 16.0f, TEXTALIGN_CENTER); UI()->DoLabel(&Text, Localize("Renderer"), 16.0f, TEXTALIGN_CENTER);
static float s_ScrollValueDropBackend = 0; static float s_ScrollValueDropBackend = 0;
static int s_BackendDropDownState = 0; static int s_BackendDropDownState = 0;
@ -1484,7 +1484,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
{ {
MainView.HSplitTop(10.0f, nullptr, &MainView); MainView.HSplitTop(10.0f, nullptr, &MainView);
MainView.HSplitTop(20.0f, &Text, &MainView); MainView.HSplitTop(20.0f, &Text, &MainView);
UI()->DoLabelScaled(&Text, Localize("Graphics cards"), 16.0f, TEXTALIGN_CENTER); UI()->DoLabel(&Text, Localize("Graphics cards"), 16.0f, TEXTALIGN_CENTER);
static float s_ScrollValueDropGPU = 0; static float s_ScrollValueDropGPU = 0;
static int s_GPUDropDownState = 0; static int s_GPUDropDownState = 0;
@ -1630,7 +1630,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_SndRate); str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_SndRate);
MainView.HSplitTop(20.0f, &Button, &MainView); MainView.HSplitTop(20.0f, &Button, &MainView);
UI()->DoLabelScaled(&Button, Localize("Sample rate"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Button, Localize("Sample rate"), 14.0f, TEXTALIGN_LEFT);
Button.VSplitLeft(190.0f, 0, &Button); Button.VSplitLeft(190.0f, 0, &Button);
static float s_Offset = 0.0f; static float s_Offset = 0.0f;
UIEx()->DoEditBox(&g_Config.m_SndRate, &Button, aBuf, sizeof(aBuf), 14.0f, &s_Offset); UIEx()->DoEditBox(&g_Config.m_SndRate, &Button, aBuf, sizeof(aBuf), 14.0f, &s_Offset);
@ -1643,7 +1643,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView); MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView); MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button); Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Sound volume"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); g_Config.m_SndVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndVolume, &Button, g_Config.m_SndVolume / 100.0f) * 100.0f);
} }
@ -1652,7 +1652,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView); MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView); MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button); Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Game sound volume"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); g_Config.m_SndGameSoundVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndGameSoundVolume, &Button, g_Config.m_SndGameSoundVolume / 100.0f) * 100.0f);
} }
@ -1661,7 +1661,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView); MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView); MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button); Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Chat sound volume"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); g_Config.m_SndChatSoundVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndChatSoundVolume, &Button, g_Config.m_SndChatSoundVolume / 100.0f) * 100.0f);
} }
@ -1670,7 +1670,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView); MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView); MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button); Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Map sound volume"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); g_Config.m_SndMapSoundVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndMapSoundVolume, &Button, g_Config.m_SndMapSoundVolume / 100.0f) * 100.0f);
} }
@ -1679,7 +1679,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView); MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView); MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(190.0f, &Label, &Button); Button.VSplitLeft(190.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Background music volume"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); g_Config.m_SndBackgroundMusicVolume = (int)(UIEx()->DoScrollbarH(&g_Config.m_SndBackgroundMusicVolume, &Button, g_Config.m_SndBackgroundMusicVolume / 100.0f) * 100.0f);
} }
} }
@ -1794,7 +1794,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f); ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f);
m_pClient->m_CountryFlags.Render(Language.m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h); m_pClient->m_CountryFlags.Render(Language.m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h);
Item.m_Rect.HSplitTop(2.0f, 0, &Item.m_Rect); Item.m_Rect.HSplitTop(2.0f, 0, &Item.m_Rect);
UI()->DoLabelScaled(&Item.m_Rect, Language.m_Name.c_str(), 16.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Item.m_Rect, Language.m_Name.c_str(), 16.0f, TEXTALIGN_LEFT);
} }
} }
@ -1905,11 +1905,11 @@ void CMenus::RenderSettings(CUIRect MainView)
if(m_NeedRestartUpdate) if(m_NeedRestartUpdate)
{ {
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f); 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, TEXTALIGN_LEFT); UI()->DoLabel(&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); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
} }
else if(m_NeedRestartGeneral || m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound || m_NeedRestartDDNet) 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, TEXTALIGN_LEFT); UI()->DoLabel(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, TEXTALIGN_LEFT);
RenderColorPicker(); RenderColorPicker();
} }
@ -2252,7 +2252,7 @@ ColorHSLA CMenus::RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool
Button.Margin(2.0f, &Rail); Button.Margin(2.0f, &Rail);
str_format(aBuf, sizeof(aBuf), "%s: %03d", aLabels[i], (int)(*paComponent[i] * 255)); str_format(aBuf, sizeof(aBuf), "%s: %03d", aLabels[i], (int)(*paComponent[i] * 255));
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
ColorHSLA CurColorPureHSLA(RenderColorHSLA.r, 1, 0.5f, 1); ColorHSLA CurColorPureHSLA(RenderColorHSLA.r, 1, 0.5f, 1);
ColorRGBA CurColorPure = color_cast<ColorRGBA>(CurColorPureHSLA); ColorRGBA CurColorPure = color_cast<ColorRGBA>(CurColorPureHSLA);
@ -2321,7 +2321,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.VSplitLeft(MainView.w * 0.55f, &MainView, &Column); MainView.VSplitLeft(MainView.w * 0.55f, &MainView, &Column);
MainView.HSplitTop(30.0f, &Section, &MainView); MainView.HSplitTop(30.0f, &Section, &MainView);
UI()->DoLabelScaled(&Section, Localize("HUD"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Section, Localize("HUD"), 20.0f, TEXTALIGN_LEFT);
MainView.VSplitLeft(5.0f, 0x0, &MainView); MainView.VSplitLeft(5.0f, 0x0, &MainView);
MainView.HSplitTop(5.0f, 0x0, &MainView); MainView.HSplitTop(5.0f, 0x0, &MainView);
@ -2348,7 +2348,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
// ***** Kill Messages ***** // // ***** Kill Messages ***** //
MainView.HSplitTop(30.0f, &Section, &MainView); MainView.HSplitTop(30.0f, &Section, &MainView);
UI()->DoLabelScaled(&Section, Localize("Kill Messages"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Section, Localize("Kill Messages"), 20.0f, TEXTALIGN_LEFT);
MainView.VSplitLeft(5.0f, 0x0, &MainView); MainView.VSplitLeft(5.0f, 0x0, &MainView);
MainView.HSplitTop(10.0f, 0x0, &MainView); MainView.HSplitTop(10.0f, 0x0, &MainView);
@ -2364,7 +2364,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView = Column; MainView = Column;
MainView.HSplitTop(30.0f, &Section, &MainView); MainView.HSplitTop(30.0f, &Section, &MainView);
UI()->DoLabelScaled(&Section, Localize("Laser"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Section, Localize("Laser"), 20.0f, TEXTALIGN_LEFT);
MainView.VSplitLeft(5.0f, 0x0, &MainView); MainView.VSplitLeft(5.0f, 0x0, &MainView);
MainView.HSplitTop(5.0f, 0x0, &MainView); MainView.HSplitTop(5.0f, 0x0, &MainView);
@ -2388,7 +2388,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.HSplitTop(25.0f, 0x0, &MainView); MainView.HSplitTop(25.0f, 0x0, &MainView);
MainView.HSplitTop(20.0f, &SectionTwo, &MainView); MainView.HSplitTop(20.0f, &SectionTwo, &MainView);
UI()->DoLabelScaled(&SectionTwo, Localize("Hookline"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&SectionTwo, Localize("Hookline"), 20.0f, TEXTALIGN_LEFT);
MainView.Margin(5.0f, &MainView); MainView.Margin(5.0f, &MainView);
@ -2397,7 +2397,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView); MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView); MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(45.0f, &Label, &Button); Button.VSplitLeft(45.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Size"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Size"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_ClHookCollSize = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClHookCollSize, &Button, g_Config.m_ClHookCollSize / 20.0f) * 20.0f); g_Config.m_ClHookCollSize = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClHookCollSize, &Button, g_Config.m_ClHookCollSize / 20.0f) * 20.0f);
} }
@ -2406,7 +2406,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.HSplitTop(5.0f, &Button, &MainView); MainView.HSplitTop(5.0f, &Button, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView); MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(45.0f, &Label, &Button); Button.VSplitLeft(45.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Alpha"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Alpha"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_ClHookCollAlpha = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClHookCollAlpha, &Button, g_Config.m_ClHookCollAlpha / 100.0f) * 100.0f); g_Config.m_ClHookCollAlpha = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClHookCollAlpha, &Button, g_Config.m_ClHookCollAlpha / 100.0f) * 100.0f);
} }
MainView.HSplitTop(5.0f, 0x0, &MainView); MainView.HSplitTop(5.0f, 0x0, &MainView);
@ -2440,7 +2440,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.HSplitTop(20.0f, &Section, &MainView); MainView.HSplitTop(20.0f, &Section, &MainView);
MainView.HSplitTop(10.0f, 0x0, &MainView); MainView.HSplitTop(10.0f, 0x0, &MainView);
UI()->DoLabelScaled(&Section, Localize("Messages"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Section, Localize("Messages"), 20.0f, TEXTALIGN_LEFT);
const float LineSize = 25.0f; const float LineSize = 25.0f;
const float WantedPickerPosition = 210.0f; const float WantedPickerPosition = 210.0f;
@ -2468,7 +2468,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
MainView.HSplitTop(10.0f, 0x0, &MainView); MainView.HSplitTop(10.0f, 0x0, &MainView);
MainView.HSplitTop(20.0f, &Section, &MainView); MainView.HSplitTop(20.0f, &Section, &MainView);
UI()->DoLabelScaled(&Section, Localize("Preview"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Section, Localize("Preview"), 20.0f, TEXTALIGN_LEFT);
MainView.HSplitTop(10.0f, 0x0, &MainView); MainView.HSplitTop(10.0f, 0x0, &MainView);
RenderTools()->DrawUIRect(&MainView, ColorRGBA(1, 1, 1, 0.1f), CUI::CORNER_ALL, 8.0f); RenderTools()->DrawUIRect(&MainView, ColorRGBA(1, 1, 1, 0.1f), CUI::CORNER_ALL, 8.0f);
@ -2654,7 +2654,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
MainView.HSplitTop(100.0f, &Demo, &MainView); MainView.HSplitTop(100.0f, &Demo, &MainView);
Demo.HSplitTop(30.0f, &Label, &Demo); Demo.HSplitTop(30.0f, &Label, &Demo);
UI()->DoLabelScaled(&Label, Localize("Demo"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Demo"), 20.0f, TEXTALIGN_LEFT);
Demo.Margin(5.0f, &Demo); Demo.Margin(5.0f, &Demo);
Demo.VSplitMid(&Left, &Right); Demo.VSplitMid(&Left, &Right);
Left.VSplitRight(5.0f, &Left, 0); Left.VSplitRight(5.0f, &Left, 0);
@ -2688,7 +2688,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Button.VSplitLeft(140.0f, &Label, &Button); Button.VSplitLeft(140.0f, &Label, &Button);
char aBuf[256]; char aBuf[256];
str_format(aBuf, sizeof(aBuf), Localize("Default length: %d"), g_Config.m_ClReplayLength); str_format(aBuf, sizeof(aBuf), Localize("Default length: %d"), g_Config.m_ClReplayLength);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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; 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) if(g_Config.m_ClReplayLength < 600 || NewValue < 600)
@ -2720,7 +2720,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
MainView.HSplitTop(330.0f, &Gameplay, &MainView); MainView.HSplitTop(330.0f, &Gameplay, &MainView);
Gameplay.HSplitTop(30.0f, &Label, &Gameplay); Gameplay.HSplitTop(30.0f, &Label, &Gameplay);
UI()->DoLabelScaled(&Label, Localize("Gameplay"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Gameplay"), 20.0f, TEXTALIGN_LEFT);
Gameplay.Margin(5.0f, &Gameplay); Gameplay.Margin(5.0f, &Gameplay);
Gameplay.VSplitMid(&Left, &Right); Gameplay.VSplitMid(&Left, &Right);
Left.VSplitRight(5.0f, &Left, 0); Left.VSplitRight(5.0f, &Left, 0);
@ -2729,7 +2729,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
{ {
Left.HSplitTop(20.0f, &Button, &Left); Left.HSplitTop(20.0f, &Button, &Left);
Button.VSplitLeft(120.0f, &Label, &Button); Button.VSplitLeft(120.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Overlay entities"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); g_Config.m_ClOverlayEntities = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClOverlayEntities, &Button, g_Config.m_ClOverlayEntities / 100.0f) * 100.0f);
} }
@ -2738,7 +2738,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Button.VSplitMid(&LeftLeft, &Button); Button.VSplitMid(&LeftLeft, &Button);
Button.VSplitLeft(50.0f, &Label, &Button); Button.VSplitLeft(50.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Size"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); 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)) if(DoButton_CheckBox(&g_Config.m_ClTextEntities, Localize("Show text entities"), g_Config.m_ClTextEntities, &LeftLeft))
@ -2752,7 +2752,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Button.VSplitMid(&LeftLeft, &Button); Button.VSplitMid(&LeftLeft, &Button);
Button.VSplitLeft(50.0f, &Label, &Button); Button.VSplitLeft(50.0f, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Opacity"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Opacity"), 14.0f, TEXTALIGN_LEFT);
g_Config.m_ClShowOthersAlpha = (int)(UIEx()->DoScrollbarH(&g_Config.m_ClShowOthersAlpha, &Button, g_Config.m_ClShowOthersAlpha / 100.0f) * 100.0f); 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 == SHOW_OTHERS_ON, &LeftLeft)) if(DoButton_CheckBox(&g_Config.m_ClShowOthers, Localize("Show others"), g_Config.m_ClShowOthers == SHOW_OTHERS_ON, &LeftLeft))
@ -2781,7 +2781,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Label.VSplitLeft(130.0f, &Label, &Button); Label.VSplitLeft(130.0f, &Label, &Button);
char aBuf[256]; char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Default zoom"), g_Config.m_ClDefaultZoom); str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Default zoom"), g_Config.m_ClDefaultZoom);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&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); 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); Right.HSplitTop(20.0f, &Button, &Right);
@ -2856,13 +2856,13 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Left.HSplitTop(25.0f, &TempLabel, &Left); Left.HSplitTop(25.0f, &TempLabel, &Left);
Left.HSplitTop(5.0f, 0x0, &Left); Left.HSplitTop(5.0f, 0x0, &Left);
UI()->DoLabelScaled(&TempLabel, Localize("Background"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&TempLabel, Localize("Background"), 20.0f, TEXTALIGN_LEFT);
Right.HSplitTop(45.0f, 0x0, &Right); Right.HSplitTop(45.0f, 0x0, &Right);
Right.HSplitTop(25.0f, &TempLabel, &Right); Right.HSplitTop(25.0f, &TempLabel, &Right);
Right.HSplitTop(5.0f, 0x0, &Miscellaneous); Right.HSplitTop(5.0f, 0x0, &Miscellaneous);
UI()->DoLabelScaled(&TempLabel, Localize("Miscellaneous"), 20.0f, TEXTALIGN_LEFT); UI()->DoLabel(&TempLabel, Localize("Miscellaneous"), 20.0f, TEXTALIGN_LEFT);
static int ResetID1 = 0; static int ResetID1 = 0;
static int ResetID2 = 0; static int ResetID2 = 0;
@ -2873,7 +2873,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Left.HSplitTop(25.0f, &Background, &Left); Left.HSplitTop(25.0f, &Background, &Left);
Background.HSplitTop(20.0f, &Background, 0); Background.HSplitTop(20.0f, &Background, 0);
Background.VSplitLeft(100.0f, &Label, &TempLabel); Background.VSplitLeft(100.0f, &Label, &TempLabel);
UI()->DoLabelScaled(&Label, Localize("Map"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Map"), 14.0f, TEXTALIGN_LEFT);
static float s_Map = 0.0f; 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); UIEx()->DoEditBox(g_Config.m_ClBackgroundEntities, &TempLabel, g_Config.m_ClBackgroundEntities, sizeof(g_Config.m_ClBackgroundEntities), 14.0f, &s_Map);
@ -2911,7 +2911,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Right.HSplitTop(5.0f, 0, &Right); Right.HSplitTop(5.0f, 0, &Right);
Right.HSplitTop(20.0f, &Label, &Right); Right.HSplitTop(20.0f, &Label, &Right);
Label.VSplitLeft(5.0f, 0, &Label); Label.VSplitLeft(5.0f, 0, &Label);
UI()->DoLabelScaled(&Label, Localize("Run on join"), 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, Localize("Run on join"), 14.0f, TEXTALIGN_LEFT);
Right.HSplitTop(20.0f, &Button, &Right); Right.HSplitTop(20.0f, &Button, &Right);
Button.VSplitLeft(5.0f, 0, &Button); Button.VSplitLeft(5.0f, 0, &Button);
SUIExEditBoxProperties EditProps; SUIExEditBoxProperties EditProps;
@ -2956,7 +2956,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
Client()->RequestDDNetInfo(); Client()->RequestDDNetInfo();
} }
} }
UI()->DoLabelScaled(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
} }
#endif #endif

View file

@ -541,7 +541,7 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
CUIRect TextureRect; CUIRect TextureRect;
ItemRect.HSplitTop(15, &ItemRect, &TextureRect); ItemRect.HSplitTop(15, &ItemRect, &TextureRect);
TextureRect.HSplitTop(10, NULL, &TextureRect); TextureRect.HSplitTop(10, NULL, &TextureRect);
UI()->DoLabelScaled(&ItemRect, s->m_aName, ItemRect.h - 2, TEXTALIGN_CENTER); UI()->DoLabel(&ItemRect, s->m_aName, ItemRect.h - 2, TEXTALIGN_CENTER);
if(s->m_RenderTexture.IsValid()) if(s->m_RenderTexture.IsValid())
{ {
Graphics()->WrapClamp(); Graphics()->WrapClamp();
@ -600,7 +600,7 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
SLabelProperties Props; SLabelProperties Props;
Props.m_AlignVertically = 0; Props.m_AlignVertically = 0;
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, Props); UI()->DoLabel(&QuickSearch, pSearchLabel, 14.0f, TEXTALIGN_LEFT, Props);
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f); float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f);
TextRender()->SetRenderFlags(0); TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL); TextRender()->SetCurFont(NULL);

View file

@ -481,7 +481,7 @@ void CRenderTools::DrawUIRect(const CUIRect *pRect, ColorRGBA Color, int Corners
// TODO: FIX US // TODO: FIX US
Graphics()->QuadsBegin(); Graphics()->QuadsBegin();
Graphics()->SetColor(Color); Graphics()->SetColor(Color);
DrawRoundRectExt(pRect->x, pRect->y, pRect->w, pRect->h, Rounding * pRect->Scale(), Corners); DrawRoundRectExt(pRect->x, pRect->y, pRect->w, pRect->h, Rounding, Corners);
Graphics()->QuadsEnd(); Graphics()->QuadsEnd();
} }

View file

@ -205,21 +205,6 @@ float CUI::PixelSize()
return Screen()->w / Graphics()->ScreenWidth(); return Screen()->w / Graphics()->ScreenWidth();
} }
void CUI::SetScale(float s)
{
g_Config.m_UiScale = (int)(s * 100.0f);
}
float CUI::Scale() const
{
return g_Config.m_UiScale / 100.0f;
}
float CUIRect::Scale() const
{
return g_Config.m_UiScale / 100.0f;
}
void CUI::ClipEnable(const CUIRect *pRect) void CUI::ClipEnable(const CUIRect *pRect)
{ {
if(IsClipped()) if(IsClipped())
@ -293,7 +278,6 @@ void CUIRect::HSplitMid(CUIRect *pTop, CUIRect *pBottom, float Spacing) const
void CUIRect::HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const void CUIRect::HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const
{ {
CUIRect r = *this; CUIRect r = *this;
Cut *= Scale();
if(pTop) if(pTop)
{ {
@ -315,7 +299,6 @@ void CUIRect::HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const
void CUIRect::HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const void CUIRect::HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const
{ {
CUIRect r = *this; CUIRect r = *this;
Cut *= Scale();
if(pTop) if(pTop)
{ {
@ -360,7 +343,6 @@ void CUIRect::VSplitMid(CUIRect *pLeft, CUIRect *pRight, float Spacing) const
void CUIRect::VSplitLeft(float Cut, CUIRect *pLeft, CUIRect *pRight) const void CUIRect::VSplitLeft(float Cut, CUIRect *pLeft, CUIRect *pRight) const
{ {
CUIRect r = *this; CUIRect r = *this;
Cut *= Scale();
if(pLeft) if(pLeft)
{ {
@ -382,7 +364,6 @@ void CUIRect::VSplitLeft(float Cut, CUIRect *pLeft, CUIRect *pRight) const
void CUIRect::VSplitRight(float Cut, CUIRect *pLeft, CUIRect *pRight) const void CUIRect::VSplitRight(float Cut, CUIRect *pLeft, CUIRect *pRight) const
{ {
CUIRect r = *this; CUIRect r = *this;
Cut *= Scale();
if(pLeft) if(pLeft)
{ {
@ -404,7 +385,6 @@ void CUIRect::VSplitRight(float Cut, CUIRect *pLeft, CUIRect *pRight) const
void CUIRect::Margin(float Cut, CUIRect *pOtherRect) const void CUIRect::Margin(float Cut, CUIRect *pOtherRect) const
{ {
CUIRect r = *this; CUIRect r = *this;
Cut *= Scale();
pOtherRect->x = r.x + Cut; pOtherRect->x = r.x + Cut;
pOtherRect->y = r.y + Cut; pOtherRect->y = r.y + Cut;
@ -415,7 +395,6 @@ void CUIRect::Margin(float Cut, CUIRect *pOtherRect) const
void CUIRect::VMargin(float Cut, CUIRect *pOtherRect) const void CUIRect::VMargin(float Cut, CUIRect *pOtherRect) const
{ {
CUIRect r = *this; CUIRect r = *this;
Cut *= Scale();
pOtherRect->x = r.x + Cut; pOtherRect->x = r.x + Cut;
pOtherRect->y = r.y; pOtherRect->y = r.y;
@ -426,7 +405,6 @@ void CUIRect::VMargin(float Cut, CUIRect *pOtherRect) const
void CUIRect::HMargin(float Cut, CUIRect *pOtherRect) const void CUIRect::HMargin(float Cut, CUIRect *pOtherRect) const
{ {
CUIRect r = *this; CUIRect r = *this;
Cut *= Scale();
pOtherRect->x = r.x; pOtherRect->x = r.x;
pOtherRect->y = r.y + Cut; pOtherRect->y = r.y + Cut;
@ -489,9 +467,9 @@ int CUI::DoPickerLogic(const void *pID, const CUIRect *pRect, float *pX, float *
return 0; return 0;
if(pX) if(pX)
*pX = clamp(m_MouseX - pRect->x, 0.0f, pRect->w) / Scale(); *pX = clamp(m_MouseX - pRect->x, 0.0f, pRect->w);
if(pY) if(pY)
*pY = clamp(m_MouseY - pRect->y, 0.0f, pRect->h) / Scale(); *pY = clamp(m_MouseY - pRect->y, 0.0f, pRect->h);
return 1; return 1;
} }
@ -569,11 +547,6 @@ void CUI::DoLabel(const CUIRect *pRect, const char *pText, float Size, int Align
DoTextLabel(pRect->x, pRect->y, pRect->w, pRect->h, pText, Size, Align, LabelProps); DoTextLabel(pRect->x, pRect->y, pRect->w, pRect->h, pText, Size, Align, LabelProps);
} }
void CUI::DoLabelScaled(const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps)
{
DoLabel(pRect, pText, Size * Scale(), Align, LabelProps);
}
void CUI::DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen, CTextCursor *pReadCursor) void CUI::DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen, CTextCursor *pReadCursor)
{ {
float AlignedSize = 0; float AlignedSize = 0;

View file

@ -12,9 +12,6 @@
class CUIRect class CUIRect
{ {
public: public:
// TODO: Refactor: Redo UI scaling
float Scale() const;
float x, y, w, h; float x, y, w, h;
/** /**
@ -323,16 +320,11 @@ public:
const CUIRect *ClipArea() const; const CUIRect *ClipArea() const;
inline bool IsClipped() const { return !m_vClips.empty(); } inline bool IsClipped() const { return !m_vClips.empty(); }
// TODO: Refactor: Redo UI scaling
void SetScale(float s);
float Scale() const;
int DoButtonLogic(const void *pID, int Checked, const CUIRect *pRect); int DoButtonLogic(const void *pID, int Checked, const CUIRect *pRect);
int DoPickerLogic(const void *pID, const CUIRect *pRect, float *pX, float *pY); int DoPickerLogic(const void *pID, const CUIRect *pRect, float *pX, float *pY);
float DoTextLabel(float x, float y, float w, float h, const char *pText, float Size, int Align, const SLabelProperties &LabelProps = {}); float DoTextLabel(float x, float y, float w, float h, const char *pText, float Size, int Align, const SLabelProperties &LabelProps = {});
void DoLabel(const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps = {}); void DoLabel(const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps = {});
void DoLabelScaled(const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps = {});
void DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen = -1, class CTextCursor *pReadCursor = NULL); void DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen = -1, class CTextCursor *pReadCursor = NULL);
void DoLabelStreamed(CUIElement::SUIElementRect &RectEl, float x, float y, float w, float h, const char *pText, float Size, int Align, float MaxWidth = -1, int AlignVertically = 1, bool StopAtEnd = false, int StrLen = -1, class CTextCursor *pReadCursor = NULL); void DoLabelStreamed(CUIElement::SUIElementRect &RectEl, float x, float y, float w, float h, const char *pText, float Size, int Align, float MaxWidth = -1, int AlignVertically = 1, bool StopAtEnd = false, int StrLen = -1, class CTextCursor *pReadCursor = NULL);

View file

@ -217,8 +217,6 @@ bool CUIEx::DoEditBox(const void *pID, const CUIRect *pRect, char *pStr, unsigne
bool ReturnValue = false; bool ReturnValue = false;
bool UpdateOffset = false; bool UpdateOffset = false;
FontSize *= UI()->Scale();
auto &&SetHasSelection = [&](bool HasSelection) { auto &&SetHasSelection = [&](bool HasSelection) {
m_HasSelection = HasSelection; m_HasSelection = HasSelection;
m_pSelItem = m_HasSelection ? pID : nullptr; m_pSelItem = m_HasSelection ? pID : nullptr;

View file

@ -1800,7 +1800,7 @@ int CEditor::PopupColorPicker(CEditor *pEditor, CUIRect View, void *pContext)
pEditor->Graphics()->QuadsEnd(); pEditor->Graphics()->QuadsEnd();
// marker // marker
vec2 Marker = vec2(hsv.y * pEditor->UI()->Scale(), (1.0f - hsv.z) * pEditor->UI()->Scale()) * vec2(SVPicker.w, SVPicker.h); vec2 Marker = vec2(hsv.y, (1.0f - hsv.z)) * vec2(SVPicker.w, SVPicker.h);
pEditor->Graphics()->QuadsBegin(); pEditor->Graphics()->QuadsBegin();
pEditor->Graphics()->SetColor(0.5f, 0.5f, 0.5f, 1.0f); pEditor->Graphics()->SetColor(0.5f, 0.5f, 0.5f, 1.0f);
IGraphics::CQuadItem aMarker[2]; IGraphics::CQuadItem aMarker[2];
@ -1847,7 +1847,7 @@ int CEditor::PopupColorPicker(CEditor *pEditor, CUIRect View, void *pContext)
// marker // marker
pEditor->Graphics()->SetColor(0.5f, 0.5f, 0.5f, 1.0f); pEditor->Graphics()->SetColor(0.5f, 0.5f, 0.5f, 1.0f);
IGraphics::CQuadItem QuadItemMarker(HuePicker.x, HuePicker.y + (1.0f - hsv.x) * HuePicker.h * pEditor->UI()->Scale(), HuePicker.w, pEditor->UI()->PixelSize()); IGraphics::CQuadItem QuadItemMarker(HuePicker.x, HuePicker.y + (1.0f - hsv.x) * HuePicker.h, HuePicker.w, pEditor->UI()->PixelSize());
pEditor->Graphics()->QuadsDrawTL(&QuadItemMarker, 1); pEditor->Graphics()->QuadsDrawTL(&QuadItemMarker, 1);
pEditor->Graphics()->QuadsEnd(); pEditor->Graphics()->QuadsEnd();

View file

@ -116,7 +116,6 @@ MACRO_CONFIG_INT(UiPage, ui_page, 9, 6, 10, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Inte
MACRO_CONFIG_INT(UiSettingsPage, ui_settings_page, 0, 0, 9, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Interface settings page") MACRO_CONFIG_INT(UiSettingsPage, ui_settings_page, 0, 0, 9, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Interface settings page")
MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Toolbox page") MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Toolbox page")
MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFLAG_CLIENT | CFGFLAG_SAVE | CFGFLAG_INSENSITIVE, "Interface server address") MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFLAG_CLIENT | CFGFLAG_SAVE | CFGFLAG_INSENSITIVE, "Interface server address")
MACRO_CONFIG_INT(UiScale, ui_scale, 100, 50, 150, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Interface scale")
MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 200, 1, 100000, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor") MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 200, 1, 100000, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor")
MACRO_CONFIG_COL(UiColor, ui_color, 0xE4A046AF, CFGFLAG_CLIENT | CFGFLAG_SAVE | CFGFLAG_COLALPHA, "Interface color") // 160 70 175 228 hasalpha MACRO_CONFIG_COL(UiColor, ui_color, 0xE4A046AF, CFGFLAG_CLIENT | CFGFLAG_SAVE | CFGFLAG_COLALPHA, "Interface color") // 160 70 175 228 hasalpha