mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
add ui fixes to work with new text renderer
This commit is contained in:
parent
0930a3b7de
commit
c1a962b870
|
@ -202,9 +202,20 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c
|
|||
|
||||
c.Margin(2.0f, &c);
|
||||
RenderTools()->DrawUIRect(&c, vec4(1,1,1,0.25f)*ButtonColorMul(pID), CUI::CORNER_ALL, 3.0f);
|
||||
c.y += 2;
|
||||
UI()->DoLabel(&c, pBoxText, pRect->h*ms_FontmodHeight*0.6f, 0);
|
||||
UI()->DoLabel(&t, pText, pRect->h*ms_FontmodHeight*0.8f, -1);
|
||||
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
|
||||
bool CheckAble = *pBoxText == 'X';
|
||||
if(CheckAble)
|
||||
{
|
||||
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
|
||||
UI()->DoLabel(&c, "\xEE\x97\x8D", c.h, 0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
}
|
||||
else
|
||||
UI()->DoLabel(&c, pBoxText, c.h*ms_FontmodHeight, 0);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
UI()->DoLabel(&t, pText, c.h*ms_FontmodHeight, -1);
|
||||
|
||||
return UI()->DoButtonLogic(pID, pText, 0, pRect);
|
||||
}
|
||||
|
||||
|
@ -321,7 +332,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
{
|
||||
if(UI()->MouseButton(0))
|
||||
{
|
||||
if (UI()->LastActiveItem() != pID)
|
||||
if(UI()->LastActiveItem() != pID)
|
||||
JustGotActive = true;
|
||||
UI()->SetActiveItem(pID);
|
||||
}
|
||||
|
@ -369,7 +380,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
{
|
||||
str_copy(aInputing, pStr, sizeof(aInputing));
|
||||
const char *Text = Input()->GetIMECandidate();
|
||||
if (str_length(Text))
|
||||
if(str_length(Text))
|
||||
{
|
||||
int NewTextLen = str_length(Text);
|
||||
int CharsLeft = StrSize - str_length(aInputing) - 1;
|
||||
|
@ -423,7 +434,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
// render the cursor
|
||||
if(UI()->LastActiveItem() == pID && !JustGotActive)
|
||||
{
|
||||
if (str_length(aInputing))
|
||||
if(str_length(aInputing))
|
||||
{
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex + Input()->GetEditingCursor());
|
||||
Textbox = *pRect;
|
||||
|
@ -621,7 +632,7 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key)
|
|||
UI()->SetHotItem(pID);
|
||||
|
||||
// draw
|
||||
if (UI()->ActiveItem() == pID && ButtonUsed == 0)
|
||||
if(UI()->ActiveItem() == pID && ButtonUsed == 0)
|
||||
DoButton_KeySelect(pID, "???", 0, pRect);
|
||||
else
|
||||
{
|
||||
|
@ -650,7 +661,7 @@ int CMenus::RenderMenubar(CUIRect r)
|
|||
// offline menus
|
||||
Box.VSplitLeft(90.0f, &Button, &Box);
|
||||
static int s_NewsButton=0;
|
||||
if (DoButton_MenuTab(&s_NewsButton, Localize("News"), m_ActivePage==PAGE_NEWS, &Button, CUI::CORNER_T))
|
||||
if(DoButton_MenuTab(&s_NewsButton, Localize("News"), m_ActivePage==PAGE_NEWS, &Button, CUI::CORNER_T))
|
||||
{
|
||||
NewPage = PAGE_NEWS;
|
||||
m_DoubleClickIndex = -1;
|
||||
|
@ -758,31 +769,38 @@ int CMenus::RenderMenubar(CUIRect r)
|
|||
/*
|
||||
box.VSplitRight(110.0f, &box, &button);
|
||||
static int system_button=0;
|
||||
if (UI()->DoButton(&system_button, "System", g_Config.m_UiPage==PAGE_SYSTEM, &button))
|
||||
if(UI()->DoButton(&system_button, "System", g_Config.m_UiPage==PAGE_SYSTEM, &button))
|
||||
g_Config.m_UiPage = PAGE_SYSTEM;
|
||||
|
||||
box.VSplitRight(30.0f, &box, 0);
|
||||
*/
|
||||
|
||||
Box.VSplitRight(30.0f, &Box, &Button);
|
||||
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);
|
||||
|
||||
Box.VSplitRight(33.0f, &Box, &Button);
|
||||
static int s_QuitButton=0;
|
||||
if(DoButton_MenuTab(&s_QuitButton, "×", 0, &Button, CUI::CORNER_T))
|
||||
if(DoButton_MenuTab(&s_QuitButton, "\xEE\x97\x8D", 0, &Button, CUI::CORNER_T))
|
||||
m_Popup = POPUP_QUIT;
|
||||
|
||||
Box.VSplitRight(10.0f, &Box, &Button);
|
||||
Box.VSplitRight(30.0f, &Box, &Button);
|
||||
Box.VSplitRight(33.0f, &Box, &Button);
|
||||
static int s_SettingsButton=0;
|
||||
if(DoButton_MenuTab(&s_SettingsButton, "⚙", m_ActivePage==PAGE_SETTINGS, &Button, CUI::CORNER_T))
|
||||
|
||||
if(DoButton_MenuTab(&s_SettingsButton, "\xEE\xA2\xB8", m_ActivePage==PAGE_SETTINGS, &Button, CUI::CORNER_T))
|
||||
NewPage = PAGE_SETTINGS;
|
||||
|
||||
Box.VSplitRight(10.0f, &Box, &Button);
|
||||
Box.VSplitRight(30.0f, &Box, &Button);
|
||||
Box.VSplitRight(33.0f, &Box, &Button);
|
||||
static int s_EditorButton=0;
|
||||
if(DoButton_MenuTab(&s_EditorButton, "✎", 0, &Button, CUI::CORNER_T))
|
||||
if(DoButton_MenuTab(&s_EditorButton, "\xEE\x8F\x89", 0, &Button, CUI::CORNER_T))
|
||||
{
|
||||
g_Config.m_ClEditor = 1;
|
||||
}
|
||||
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
|
||||
if(NewPage != -1)
|
||||
{
|
||||
if(Client()->State() == IClient::STATE_OFFLINE)
|
||||
|
@ -837,7 +855,7 @@ void CMenus::RenderLoading()
|
|||
r.x = x;
|
||||
r.y = y+20;
|
||||
r.w = w;
|
||||
r.h = h;
|
||||
r.h = h - 130;
|
||||
UI()->DoLabel(&r, pCaption, 48.0f, 0, -1);
|
||||
|
||||
Graphics()->TextureSet(-1);
|
||||
|
@ -863,7 +881,7 @@ void CMenus::RenderNews(CUIRect MainView)
|
|||
|
||||
std::istringstream f(Client()->m_aNews);
|
||||
std::string line;
|
||||
while (std::getline(f, line))
|
||||
while(std::getline(f, line))
|
||||
{
|
||||
if(line.size() > 0 && line.at(0) == '|' && line.at(line.size()-1) == '|')
|
||||
{
|
||||
|
@ -1089,7 +1107,7 @@ int CMenus::Render()
|
|||
pExtraText = "";
|
||||
}
|
||||
}
|
||||
else if (m_Popup == POPUP_DISCONNECTED)
|
||||
else if(m_Popup == POPUP_DISCONNECTED)
|
||||
{
|
||||
pTitle = Localize("Disconnected");
|
||||
pExtraText = Client()->ErrorString();
|
||||
|
@ -1618,7 +1636,7 @@ int CMenus::Render()
|
|||
#endif
|
||||
|
||||
Part.VSplitLeft(60.0f, 0, &Part);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrIndicateFinished, Localize("Show DDNet map finishes in server browser\n(transmits your player name to info.ddnet.tw)"), g_Config.m_BrIndicateFinished, &Part))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrIndicateFinished, Localize("Show DDNet map finishes in server browser\n(transmits your player name to info.ddnet.tw)"), g_Config.m_BrIndicateFinished, &Part))
|
||||
g_Config.m_BrIndicateFinished ^= 1;
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
|
@ -1794,7 +1812,7 @@ void CMenus::OnStateChange(int NewState, int OldState)
|
|||
}
|
||||
else if(NewState == IClient::STATE_CONNECTING)
|
||||
m_Popup = POPUP_CONNECTING;
|
||||
else if (NewState == IClient::STATE_ONLINE || NewState == IClient::STATE_DEMOPLAYBACK)
|
||||
else if(NewState == IClient::STATE_ONLINE || NewState == IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
m_Popup = POPUP_NONE;
|
||||
SetActive(false);
|
||||
|
@ -2011,6 +2029,7 @@ void CMenus::RenderUpdating(const char *pCaption, int current, int total)
|
|||
CUIRect Screen = *UI()->Screen();
|
||||
Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h);
|
||||
|
||||
Graphics()->BlendNormal();
|
||||
RenderBackground();
|
||||
|
||||
float w = 700;
|
||||
|
@ -2018,8 +2037,6 @@ void CMenus::RenderUpdating(const char *pCaption, int current, int total)
|
|||
float x = Screen.w/2-w/2;
|
||||
float y = Screen.h/2-h/2;
|
||||
|
||||
Graphics()->BlendNormal();
|
||||
|
||||
Graphics()->TextureSet(-1);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(0,0,0,0.50f);
|
||||
|
@ -2033,7 +2050,7 @@ void CMenus::RenderUpdating(const char *pCaption, int current, int total)
|
|||
r.h = h;
|
||||
UI()->DoLabel(&r, Localize(pCaption), 32.0f, 0, -1);
|
||||
|
||||
if (total>0)
|
||||
if(total>0)
|
||||
{
|
||||
float Percent = current/(float)total;
|
||||
Graphics()->TextureSet(-1);
|
||||
|
|
|
@ -141,7 +141,6 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
// users misses it
|
||||
{
|
||||
CUIRect MsgBox = View;
|
||||
MsgBox.y += View.h/3;
|
||||
|
||||
if(m_ActivePage == PAGE_INTERNET && ServerBrowser()->IsRefreshingMasters())
|
||||
UI()->DoLabelScaled(&MsgBox, Localize("Refreshing master servers"), 16.0f, 0);
|
||||
|
@ -240,7 +239,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
// reset friend counter
|
||||
for(int i = 0; i < m_lFriends.size(); m_lFriends[i++].m_NumFound = 0);
|
||||
|
||||
for (int i = 0; i < NumServers; i++)
|
||||
for(int i = 0; i < NumServers; i++)
|
||||
{
|
||||
int ItemIndex = i;
|
||||
const CServerInfo *pItem = ServerBrowser()->SortedGet(ItemIndex);
|
||||
|
@ -285,7 +284,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
if(Selected)
|
||||
{
|
||||
CUIRect r = Row;
|
||||
r.Margin(1.5f, &r);
|
||||
r.Margin(0.5f, &r);
|
||||
RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f);
|
||||
}
|
||||
|
||||
|
@ -340,7 +339,8 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
else if(ID == COL_NAME)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
float FontSize = 12.0f * UI()->Scale();
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
|
||||
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit&IServerBrowser::QUICK_SERVERNAME))
|
||||
|
@ -374,7 +374,8 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
}
|
||||
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
float FontSize = 12.0f * UI()->Scale();
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - FontSize) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
|
||||
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit&IServerBrowser::QUICK_MAPNAME))
|
||||
|
@ -418,7 +419,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
else if(ID == COL_PING)
|
||||
{
|
||||
str_format(aTemp, sizeof(aTemp), "%i", pItem->m_Latency);
|
||||
if (g_Config.m_UiColorizePing)
|
||||
if(g_Config.m_UiColorizePing)
|
||||
{
|
||||
vec3 rgb = HslToRgb(vec3((300.0f - clamp(pItem->m_Latency, 0, 300)) / 1000.0f, 1.0f, 0.5f));
|
||||
TextRender()->TextColor(rgb.r, rgb.g, rgb.b, 1.0f);
|
||||
|
@ -435,26 +436,27 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
else if(ID == COL_GAMETYPE)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
float FontSize = 12.0f * UI()->Scale();
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - FontSize) / 2.f, 12.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
|
||||
if (g_Config.m_UiColorizeGametype)
|
||||
if(g_Config.m_UiColorizeGametype)
|
||||
{
|
||||
vec3 hsl = vec3(1.0f, 1.0f, 1.0f);
|
||||
|
||||
if (IsVanilla(pItem))
|
||||
if(IsVanilla(pItem))
|
||||
hsl = vec3(0.33f, 1.0f, 0.75f);
|
||||
else if (IsCatch(pItem))
|
||||
else if(IsCatch(pItem))
|
||||
hsl = vec3(0.17f, 1.0f, 0.75f);
|
||||
else if (IsInsta(pItem))
|
||||
else if(IsInsta(pItem))
|
||||
hsl = vec3(0.00f, 1.0f, 0.75f);
|
||||
else if (IsFNG(pItem))
|
||||
else if(IsFNG(pItem))
|
||||
hsl = vec3(0.83f, 1.0f, 0.75f);
|
||||
else if (IsDDNet(pItem))
|
||||
else if(IsDDNet(pItem))
|
||||
hsl = vec3(0.58f, 1.0f, 0.75f);
|
||||
else if (IsDDRace(pItem))
|
||||
else if(IsDDRace(pItem))
|
||||
hsl = vec3(0.75f, 1.0f, 0.75f);
|
||||
else if (IsRace(pItem))
|
||||
else if(IsRace(pItem))
|
||||
hsl = vec3(0.46f, 1.0f, 0.75f);
|
||||
|
||||
vec3 rgb = HslToRgb(hsl);
|
||||
|
@ -493,9 +495,13 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
QuickExclude.VSplitLeft(5.0f, 0, &QuickExclude);
|
||||
// render quick search
|
||||
{
|
||||
const char *pLabel = "⚲";
|
||||
UI()->DoLabelScaled(&QuickSearch, pLabel, 12.0f, -1);
|
||||
float w = TextRender()->TextWidth(0, 12.0f, pLabel, -1);
|
||||
const char *pLabel = "\xEE\xA2\xB6";
|
||||
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
|
||||
UI()->DoLabelScaled(&QuickSearch, pLabel, 16.0f, -1);
|
||||
float w = TextRender()->TextWidth(0, 16.0f, pLabel, -1);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
QuickSearch.VSplitLeft(w, 0, &QuickSearch);
|
||||
QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
|
||||
QuickSearch.VSplitLeft(QuickSearch.w-15.0f, &QuickSearch, &Button);
|
||||
|
@ -521,9 +527,13 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
|
||||
// render quick exclude
|
||||
{
|
||||
const char *pLabel = Localize("✗");
|
||||
UI()->DoLabelScaled(&QuickExclude, pLabel, 12.0f, -1);
|
||||
float w = TextRender()->TextWidth(0, 12.0f, pLabel, -1);
|
||||
const char *pLabel = Localize("\xEE\x85\x8B");
|
||||
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);
|
||||
UI()->DoLabelScaled(&QuickExclude, pLabel, 16.0f, -1);
|
||||
float w = TextRender()->TextWidth(0, 16.0f, pLabel, -1);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
QuickExclude.VSplitLeft(w, 0, &QuickExclude);
|
||||
QuickExclude.VSplitLeft(5.0f, 0, &QuickExclude);
|
||||
QuickExclude.VSplitLeft(QuickExclude.w-15.0f, &QuickExclude, &Button);
|
||||
|
@ -572,7 +582,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
|||
ServerFilter.VMargin(5.0f, &ServerFilter);
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterEmpty, Localize("Has people playing"), g_Config.m_BrFilterEmpty, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterEmpty, Localize("Has people playing"), g_Config.m_BrFilterEmpty, &Button))
|
||||
g_Config.m_BrFilterEmpty ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
|
@ -580,31 +590,31 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
|||
g_Config.m_BrFilterSpectators ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterFull, Localize("Server not full"), g_Config.m_BrFilterFull, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterFull, Localize("Server not full"), g_Config.m_BrFilterFull, &Button))
|
||||
g_Config.m_BrFilterFull ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterFriends, Localize("Show friends only"), g_Config.m_BrFilterFriends, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterFriends, Localize("Show friends only"), g_Config.m_BrFilterFriends, &Button))
|
||||
g_Config.m_BrFilterFriends ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterPw, Localize("No password"), g_Config.m_BrFilterPw, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterPw, Localize("No password"), g_Config.m_BrFilterPw, &Button))
|
||||
g_Config.m_BrFilterPw ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterCompatversion, Localize("Compatible version"), g_Config.m_BrFilterCompatversion, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterCompatversion, Localize("Compatible version"), g_Config.m_BrFilterCompatversion, &Button))
|
||||
g_Config.m_BrFilterCompatversion ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterPure, Localize("Standard gametype"), g_Config.m_BrFilterPure, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterPure, Localize("Standard gametype"), g_Config.m_BrFilterPure, &Button))
|
||||
g_Config.m_BrFilterPure ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterPureMap, Localize("Standard map"), g_Config.m_BrFilterPureMap, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterPureMap, Localize("Standard map"), g_Config.m_BrFilterPureMap, &Button))
|
||||
g_Config.m_BrFilterPureMap ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterGametypeStrict, Localize("Strict gametype filter"), g_Config.m_BrFilterGametypeStrict, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterGametypeStrict, Localize("Strict gametype filter"), g_Config.m_BrFilterGametypeStrict, &Button))
|
||||
g_Config.m_BrFilterGametypeStrict ^= 1;
|
||||
|
||||
ServerFilter.HSplitTop(5.0f, 0, &ServerFilter);
|
||||
|
@ -669,13 +679,13 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
|||
if(g_Config.m_UiPage == PAGE_DDNET)
|
||||
{
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrIndicateFinished, Localize("Indicate map finish"), g_Config.m_BrIndicateFinished, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrIndicateFinished, Localize("Indicate map finish"), g_Config.m_BrIndicateFinished, &Button))
|
||||
g_Config.m_BrIndicateFinished ^= 1;
|
||||
|
||||
if(g_Config.m_BrIndicateFinished)
|
||||
{
|
||||
ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter);
|
||||
if (DoButton_CheckBox(&g_Config.m_BrFilterUnfinishedMap, Localize("Unfinished map"), g_Config.m_BrFilterUnfinishedMap, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_BrFilterUnfinishedMap, Localize("Unfinished map"), g_Config.m_BrFilterUnfinishedMap, &Button))
|
||||
g_Config.m_BrFilterUnfinishedMap ^= 1;
|
||||
}
|
||||
else
|
||||
|
@ -761,7 +771,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
|||
{
|
||||
// right click to exclusively activate one
|
||||
g_Config.m_BrFilterExcludeTypes[0] = '\0';
|
||||
for (int j = 0; j < MaxTypes; ++j)
|
||||
for(int j = 0; j < MaxTypes; ++j)
|
||||
{
|
||||
if(j != TypeIndex)
|
||||
ServerBrowser()->DDNetFilterAdd(g_Config.m_BrFilterExcludeTypes, ServerBrowser()->GetDDNetType(j));
|
||||
|
@ -842,7 +852,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
|||
{
|
||||
// right click to exclusively activate one
|
||||
g_Config.m_BrFilterExcludeCountries[0] = '\0';
|
||||
for (int j = 0; j < MaxFlags; ++j)
|
||||
for(int j = 0; j < MaxFlags; ++j)
|
||||
{
|
||||
if(j != CountryIndex)
|
||||
ServerBrowser()->DDNetFilterAdd(g_Config.m_BrFilterExcludeCountries, ServerBrowser()->GetDDNetCountryName(j));
|
||||
|
@ -858,7 +868,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
|||
|
||||
vec4 Color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
if (!Active)
|
||||
if(!Active)
|
||||
Color.a = 0.2f;
|
||||
|
||||
m_pClient->m_pCountryFlags->Render(FlagID, &Color, Pos.x, Pos.y, FlagWidth, FlagHeight);
|
||||
|
@ -912,7 +922,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
RenderTools()->DrawUIRect(&ServerDetails, vec4(0,0,0,0.15f), CUI::CORNER_B, 4.0f);
|
||||
UI()->DoLabelScaled(&ServerHeader, Localize("Server details"), FontSize+2.0f, 0);
|
||||
|
||||
if (pSelectedServer)
|
||||
if(pSelectedServer)
|
||||
{
|
||||
ServerDetails.VSplitLeft(5.0f, 0, &ServerDetails);
|
||||
ServerDetails.Margin(3.0f, &ServerDetails);
|
||||
|
@ -944,7 +954,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
ServerDetails.VSplitLeft(5.0f, 0x0, &ServerDetails);
|
||||
ServerDetails.VSplitLeft(80.0f, &LeftColumn, &RightColumn);
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(s_aLabels) / sizeof(s_aLabels[0]); i++)
|
||||
for(unsigned int i = 0; i < sizeof(s_aLabels) / sizeof(s_aLabels[0]); i++)
|
||||
{
|
||||
LeftColumn.HSplitTop(15.0f, &Row, &LeftColumn);
|
||||
UI()->DoLabelScaled(&Row, s_aLabels[i], FontSize, -1);
|
||||
|
@ -978,7 +988,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
static float s_ScrollValue = 0;
|
||||
UiDoListboxStart(&s_VoteList, &ServerScoreBoard, 26.0f, Localize("Scoreboard"), "", pSelectedServer->m_NumReceivedClients, 1, -1, s_ScrollValue);
|
||||
|
||||
for (int i = 0; i < pSelectedServer->m_NumReceivedClients; i++)
|
||||
for(int i = 0; i < pSelectedServer->m_NumReceivedClients; i++)
|
||||
{
|
||||
CListboxItem Item = UiDoListboxNextItem(&i);
|
||||
|
||||
|
@ -1004,7 +1014,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
Name.VSplitLeft(34.0f, &Score, &Name);
|
||||
Name.VSplitRight(34.0f, &Name, &Flag);
|
||||
Flag.HMargin(4.0f, &Flag);
|
||||
Name.HSplitTop(11.0f, &Name, &Clan);
|
||||
Name.HSplitTop(12.0f, &Name, &Clan);
|
||||
|
||||
// score
|
||||
char aTemp[16];
|
||||
|
@ -1024,12 +1034,12 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
else
|
||||
str_format(aTemp, sizeof(aTemp), "%d", pSelectedServer->m_aClients[i].m_Score);
|
||||
|
||||
TextRender()->SetCursor(&Cursor, Score.x, Score.y+(Score.h-FontSize)/4.0f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
TextRender()->SetCursor(&Cursor, Score.x, Score.y+(Score.h-FontSize)/2.0f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Score.w;
|
||||
TextRender()->TextEx(&Cursor, aTemp, -1);
|
||||
|
||||
// name
|
||||
TextRender()->SetCursor(&Cursor, Name.x, Name.y, FontSize-2, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
TextRender()->SetCursor(&Cursor, Name.x, Name.y + (Name.h - (FontSize - 2)) / 2.f, FontSize - 2, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Name.w;
|
||||
const char *pName = pSelectedServer->m_aClients[i].m_aName;
|
||||
if(g_Config.m_BrFilterString[0])
|
||||
|
@ -1051,7 +1061,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
TextRender()->TextEx(&Cursor, pName, -1);
|
||||
|
||||
// clan
|
||||
TextRender()->SetCursor(&Cursor, Clan.x, Clan.y, FontSize-2, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
TextRender()->SetCursor(&Cursor, Clan.x, Clan.y + (Clan.h - (FontSize - 2)) / 2.f, FontSize - 2, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Clan.w;
|
||||
const char *pClan = pSelectedServer->m_aClients[i].m_aClan;
|
||||
if(g_Config.m_BrFilterString[0])
|
||||
|
@ -1161,7 +1171,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
|
|||
{
|
||||
bool Found = false;
|
||||
int NumServers = ServerBrowser()->NumSortedServers();
|
||||
for (int i = 0; i < NumServers && !Found; i++)
|
||||
for(int i = 0; i < NumServers && !Found; i++)
|
||||
{
|
||||
int ItemIndex = m_SelectedIndex != -1 ? (m_SelectedIndex+i+1)%NumServers : i;
|
||||
const CServerInfo *pItem = ServerBrowser()->SortedGet(ItemIndex);
|
||||
|
@ -1274,15 +1284,15 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
|
|||
ms_ColorTabbarInactive = vec4(0.0f, 0.0f, 0.0f, 0.15f);
|
||||
|
||||
static int s_FiltersTab = 0;
|
||||
if (DoButton_MenuTab(&s_FiltersTab, Localize("Filter"), ToolboxPage==0, &TabButton0, CUI::CORNER_L))
|
||||
if(DoButton_MenuTab(&s_FiltersTab, Localize("Filter"), ToolboxPage==0, &TabButton0, CUI::CORNER_L))
|
||||
ToolboxPage = 0;
|
||||
|
||||
static int s_InfoTab = 0;
|
||||
if (DoButton_MenuTab(&s_InfoTab, Localize("Info"), ToolboxPage==1, &TabButton1, CUI::CORNER_L))
|
||||
if(DoButton_MenuTab(&s_InfoTab, Localize("Info"), ToolboxPage==1, &TabButton1, CUI::CORNER_L))
|
||||
ToolboxPage = 1;
|
||||
|
||||
static int s_FriendsTab = 0;
|
||||
if (DoButton_MenuTab(&s_FriendsTab, Localize("Friends"), ToolboxPage==2, &TabButton2, CUI::CORNER_L))
|
||||
if(DoButton_MenuTab(&s_FriendsTab, Localize("Friends"), ToolboxPage==2, &TabButton2, CUI::CORNER_L))
|
||||
ToolboxPage = 2;
|
||||
|
||||
ms_ColorTabbarActive = Active;
|
||||
|
|
|
@ -74,7 +74,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
static int64 LastSpeedChange = 0;
|
||||
|
||||
// render popups
|
||||
if (m_DemoPlayerState == DEMOPLAYER_SLICE_SAVE)
|
||||
if(m_DemoPlayerState == DEMOPLAYER_SLICE_SAVE)
|
||||
{
|
||||
CUIRect Screen = *UI()->Screen();
|
||||
CUIRect Box, Part, Part2;
|
||||
|
@ -191,7 +191,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
TotalHeight = SeekBarHeight+ButtonbarHeight+NameBarHeight+Margins*3;
|
||||
|
||||
// render speed info
|
||||
if (g_Config.m_ClDemoShowSpeed && time_get() - LastSpeedChange < time_freq() * 1)
|
||||
if(g_Config.m_ClDemoShowSpeed && time_get() - LastSpeedChange < time_freq() * 1)
|
||||
{
|
||||
CUIRect Screen = *UI()->Screen();
|
||||
|
||||
|
@ -250,7 +250,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
|
||||
// draw slice markers
|
||||
// begin
|
||||
if (g_Config.m_ClDemoSliceBegin != -1)
|
||||
if(g_Config.m_ClDemoSliceBegin != -1)
|
||||
{
|
||||
float Ratio = (g_Config.m_ClDemoSliceBegin-pInfo->m_FirstTick) / (float)TotalTicks;
|
||||
Graphics()->TextureSet(-1);
|
||||
|
@ -262,7 +262,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
}
|
||||
|
||||
// end
|
||||
if (g_Config.m_ClDemoSliceEnd != -1)
|
||||
if(g_Config.m_ClDemoSliceEnd != -1)
|
||||
{
|
||||
float Ratio = (g_Config.m_ClDemoSliceEnd-pInfo->m_FirstTick) / (float)TotalTicks;
|
||||
Graphics()->TextureSet(-1);
|
||||
|
@ -717,7 +717,7 @@ void CMenus::DemolistPopulate()
|
|||
|
||||
void CMenus::DemolistOnUpdate(bool Reset)
|
||||
{
|
||||
if (Reset)
|
||||
if(Reset)
|
||||
g_Config.m_UiDemoSelected[0] = '\0';
|
||||
else
|
||||
{
|
||||
|
@ -728,14 +728,14 @@ void CMenus::DemolistOnUpdate(bool Reset)
|
|||
{
|
||||
SelectedIndex++;
|
||||
|
||||
if (str_comp(g_Config.m_UiDemoSelected, r.front().m_aName) == 0)
|
||||
if(str_comp(g_Config.m_UiDemoSelected, r.front().m_aName) == 0)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Found)
|
||||
if(Found)
|
||||
m_DemolistSelectedIndex = SelectedIndex;
|
||||
}
|
||||
|
||||
|
@ -1102,23 +1102,23 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
|
||||
int ID = s_aCols[c].m_ID;
|
||||
|
||||
if (ID == COL_ICON)
|
||||
if(ID == COL_ICON)
|
||||
{
|
||||
DoButton_Icon(IMAGE_FILEICONS, r.front().m_IsDir?SPRITE_FILE_FOLDER:SPRITE_FILE_DEMO1, &Button);
|
||||
}
|
||||
else if(ID == COL_DEMONAME)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
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);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
|
||||
TextRender()->TextEx(&Cursor, r.front().m_aName, -1);
|
||||
|
||||
}
|
||||
else if (ID == COL_DATE && !r.front().m_IsDir)
|
||||
else if(ID == COL_DATE && !r.front().m_IsDir)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
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);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
|
||||
char aBuf[256];
|
||||
|
@ -1134,9 +1134,9 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
bool Activated = false;
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
if (m_EnterPressed || (DoubleClicked && UI()->HotItem() == m_lDemos[m_DemolistSelectedIndex].m_aName))
|
||||
if(m_EnterPressed || (DoubleClicked && UI()->HotItem() == m_lDemos[m_DemolistSelectedIndex].m_aName))
|
||||
#else
|
||||
if (m_EnterPressed || (Input()->MouseDoubleClick() && UI()->HotItem() == m_lDemos[m_DemolistSelectedIndex].m_aName))
|
||||
if(m_EnterPressed || (Input()->MouseDoubleClick() && UI()->HotItem() == m_lDemos[m_DemolistSelectedIndex].m_aName))
|
||||
#endif
|
||||
{
|
||||
UI()->SetActiveItem(0);
|
||||
|
|
|
@ -615,9 +615,13 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
{
|
||||
Bottom.VSplitLeft(240.0f, &QuickSearch, &Bottom);
|
||||
QuickSearch.HSplitTop(5.0f, 0, &QuickSearch);
|
||||
const char *pSearchLabel = "⚲";
|
||||
const char *pSearchLabel = "\xEE\xA2\xB6";
|
||||
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
|
||||
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1);
|
||||
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch);
|
||||
QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
|
||||
QuickSearch.VSplitLeft(QuickSearch.w-15.0f, &QuickSearch, &Button2);
|
||||
|
@ -786,7 +790,7 @@ void CMenus::RenderInGameNetwork(CUIRect MainView)
|
|||
static int s_InternetButton=0;
|
||||
if(DoButton_MenuTab(&s_InternetButton, Localize("Internet"), Page==PAGE_INTERNET, &Button, CUI::CORNER_BL))
|
||||
{
|
||||
if (Page != PAGE_INTERNET)
|
||||
if(Page != PAGE_INTERNET)
|
||||
ServerBrowser()->Refresh(IServerBrowser::TYPE_INTERNET);
|
||||
NewPage = PAGE_INTERNET;
|
||||
}
|
||||
|
@ -795,7 +799,7 @@ void CMenus::RenderInGameNetwork(CUIRect MainView)
|
|||
static int s_LanButton=0;
|
||||
if(DoButton_MenuTab(&s_LanButton, Localize("LAN"), Page==PAGE_LAN, &Button, 0))
|
||||
{
|
||||
if (Page != PAGE_LAN)
|
||||
if(Page != PAGE_LAN)
|
||||
ServerBrowser()->Refresh(IServerBrowser::TYPE_LAN);
|
||||
NewPage = PAGE_LAN;
|
||||
}
|
||||
|
@ -804,7 +808,7 @@ void CMenus::RenderInGameNetwork(CUIRect MainView)
|
|||
static int s_FavoritesButton=0;
|
||||
if(DoButton_MenuTab(&s_FavoritesButton, Localize("Favorites"), Page==PAGE_FAVORITES, &Button, 0))
|
||||
{
|
||||
if (Page != PAGE_FAVORITES)
|
||||
if(Page != PAGE_FAVORITES)
|
||||
ServerBrowser()->Refresh(IServerBrowser::TYPE_FAVORITES);
|
||||
NewPage = PAGE_FAVORITES;
|
||||
}
|
||||
|
@ -813,7 +817,7 @@ void CMenus::RenderInGameNetwork(CUIRect MainView)
|
|||
static int s_DDNetButton=0;
|
||||
if(DoButton_MenuTab(&s_DDNetButton, Localize("DDNet"), Page==PAGE_DDNET, &Button, CUI::CORNER_BR) || Page < PAGE_INTERNET || Page > PAGE_DDNET)
|
||||
{
|
||||
if (Page != PAGE_DDNET)
|
||||
if(Page != PAGE_DDNET)
|
||||
{
|
||||
Client()->RequestDDNetInfo();
|
||||
ServerBrowser()->Refresh(IServerBrowser::TYPE_DDNET);
|
||||
|
@ -1035,7 +1039,7 @@ void CMenus::RenderGhost(CUIRect MainView)
|
|||
|
||||
int NewSelected = -1;
|
||||
|
||||
for (int i = 0; i < NumGhosts; i++)
|
||||
for(int i = 0; i < NumGhosts; i++)
|
||||
{
|
||||
const CGhostItem *pItem = &m_lGhosts[i];
|
||||
CUIRect Row;
|
||||
|
@ -1101,7 +1105,7 @@ void CMenus::RenderGhost(CUIRect MainView)
|
|||
else if(Id == COL_NAME)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
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);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
|
||||
TextRender()->TextEx(&Cursor, pItem->m_aPlayer, -1);
|
||||
|
@ -1109,7 +1113,7 @@ void CMenus::RenderGhost(CUIRect MainView)
|
|||
else if(Id == COL_TIME)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
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);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
|
||||
char aBuf[64];
|
||||
|
|
|
@ -237,7 +237,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
|
|||
Right.HSplitTop(20.0f, 0, &Right); //
|
||||
Right.HSplitTop(20.0f, 0, &Right); // Make some distance so it looks more natural
|
||||
Right.HSplitTop(20.0f, &Button, &Right);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClAutoCSV,
|
||||
if(DoButton_CheckBox(&g_Config.m_ClAutoCSV,
|
||||
Localize("Automatically create statboard csv"),
|
||||
g_Config.m_ClAutoCSV, &Button))
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
|
|||
Right.HSplitTop(10.0f, 0, &Right);
|
||||
Right.HSplitTop(20.0f, &Label, &Right);
|
||||
Button.VSplitRight(20.0f, &Button, 0);
|
||||
if (g_Config.m_ClAutoCSVMax)
|
||||
if(g_Config.m_ClAutoCSVMax)
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max CSVs"), g_Config.m_ClAutoCSVMax);
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max CSVs"), "∞");
|
||||
|
@ -453,7 +453,6 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
Label.VSplitLeft(230.0f, &Label, 0);
|
||||
RenderTools()->DrawUIRect(&Label, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f);
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &OwnSkinInfo, 0, vec2(1, 0), vec2(Label.x+30.0f, Label.y+28.0f));
|
||||
Label.HSplitTop(15.0f, 0, &Label);
|
||||
Label.VSplitLeft(70.0f, 0, &Label);
|
||||
UI()->DoLabelScaled(&Label, Skin, 14.0f, -1, 150.0f);
|
||||
|
||||
|
@ -586,7 +585,6 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
|
||||
|
||||
Item.m_Rect.VSplitLeft(60.0f, 0, &Item.m_Rect);
|
||||
Item.m_Rect.HSplitTop(10.0f, 0, &Item.m_Rect);
|
||||
str_format(aBuf, sizeof(aBuf), "%s", s->m_aName);
|
||||
RenderTools()->UI()->DoLabelScaled(&Item.m_Rect, aBuf, 12.0f, -1,Item.m_Rect.w);
|
||||
if(g_Config.m_Debug)
|
||||
|
@ -617,9 +615,13 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
MainView.HSplitBottom(ms_ButtonHeight, &MainView, &QuickSearch);
|
||||
QuickSearch.VSplitLeft(240.0f, &QuickSearch, 0);
|
||||
QuickSearch.HSplitTop(5.0f, 0, &QuickSearch);
|
||||
const char *pSearchLabel = "⚲";
|
||||
const char *pSearchLabel = "\xEE\xA2\xB6";
|
||||
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
|
||||
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1);
|
||||
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch);
|
||||
QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
|
||||
QuickSearch.VSplitLeft(QuickSearch.w-15.0f, &QuickSearch, &QuickSearchClearButton);
|
||||
|
@ -1346,13 +1348,14 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
|
|||
static CFont *pDefaultFont = 0;
|
||||
char aFilename[512];
|
||||
const char *pFontFile = "fonts/DejaVuSansCJKName.ttf";
|
||||
if (str_find(g_Config.m_ClLanguagefile, "chinese") != NULL || str_find(g_Config.m_ClLanguagefile, "japanese") != NULL ||
|
||||
if(str_find(g_Config.m_ClLanguagefile, "chinese") != NULL || str_find(g_Config.m_ClLanguagefile, "japanese") != NULL ||
|
||||
str_find(g_Config.m_ClLanguagefile, "korean") != NULL)
|
||||
pFontFile = "fonts/DejavuWenQuanYiMicroHei.ttf";
|
||||
IOHANDLE File = Storage()->OpenFile(pFontFile, IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename));
|
||||
if(File)
|
||||
{
|
||||
io_close(File);
|
||||
if((pDefaultFont = TextRender()->GetFont(aFilename)) == NULL)
|
||||
pDefaultFont = TextRender()->LoadFont(aFilename);
|
||||
TextRender()->SetDefaultFont(pDefaultFont);
|
||||
}
|
||||
|
@ -1465,49 +1468,49 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
|
||||
|
||||
Left.HSplitTop(20.0f, &Button, &Left);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClDDRaceScoreBoard, Localize("Use DDRace Scoreboard"), g_Config.m_ClDDRaceScoreBoard, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_ClDDRaceScoreBoard, Localize("Use DDRace Scoreboard"), g_Config.m_ClDDRaceScoreBoard, &Button))
|
||||
{
|
||||
g_Config.m_ClDDRaceScoreBoard ^= 1;
|
||||
}
|
||||
|
||||
Left.HSplitTop(20.0f, &Button, &Left);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClShowIDs, Localize("Show client IDs in Scoreboard"), g_Config.m_ClShowIDs, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_ClShowIDs, Localize("Show client IDs in Scoreboard"), g_Config.m_ClShowIDs, &Button))
|
||||
{
|
||||
g_Config.m_ClShowIDs ^= 1;
|
||||
}
|
||||
|
||||
Right.HSplitTop(20.0f, &Button, &Right);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClShowhudScore, Localize("Show score"), g_Config.m_ClShowhudScore, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_ClShowhudScore, Localize("Show score"), g_Config.m_ClShowhudScore, &Button))
|
||||
{
|
||||
g_Config.m_ClShowhudScore ^= 1;
|
||||
}
|
||||
|
||||
Right.HSplitTop(20.0f, &Button, &Right);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClShowhudHealthAmmo, Localize("Show health + ammo"), g_Config.m_ClShowhudHealthAmmo, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_ClShowhudHealthAmmo, Localize("Show health + ammo"), g_Config.m_ClShowhudHealthAmmo, &Button))
|
||||
{
|
||||
g_Config.m_ClShowhudHealthAmmo ^= 1;
|
||||
}
|
||||
|
||||
Left.HSplitTop(20.0f, &Button, &Left);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClShowChat, Localize("Show chat"), g_Config.m_ClShowChat, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_ClShowChat, Localize("Show chat"), g_Config.m_ClShowChat, &Button))
|
||||
{
|
||||
g_Config.m_ClShowChat ^= 1;
|
||||
}
|
||||
|
||||
Right.HSplitTop(20.0f, &Button, &Right);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClChatTeamColors, Localize("Show names in chat in team colors"), g_Config.m_ClChatTeamColors, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_ClChatTeamColors, Localize("Show names in chat in team colors"), g_Config.m_ClChatTeamColors, &Button))
|
||||
{
|
||||
g_Config.m_ClChatTeamColors ^= 1;
|
||||
}
|
||||
|
||||
Left.HSplitTop(20.0f, &Button, &Left);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Show kill messages"), g_Config.m_ClShowKillMessages, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Show kill messages"), g_Config.m_ClShowKillMessages, &Button))
|
||||
{
|
||||
g_Config.m_ClShowKillMessages ^= 1;
|
||||
}
|
||||
|
||||
Right.HSplitTop(20.0f, &Button, &Right);
|
||||
if (DoButton_CheckBox(&g_Config.m_ClShowVotesAfterVoting, Localize("Show votes window after voting"), g_Config.m_ClShowVotesAfterVoting, &Button))
|
||||
if(DoButton_CheckBox(&g_Config.m_ClShowVotesAfterVoting, Localize("Show votes window after voting"), g_Config.m_ClShowVotesAfterVoting, &Button))
|
||||
{
|
||||
g_Config.m_ClShowVotesAfterVoting ^= 1;
|
||||
}
|
||||
|
@ -1526,7 +1529,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Label, Localize("System message"), 16.0f, -1);
|
||||
{
|
||||
static int s_DefaultButton = 0;
|
||||
if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
{
|
||||
vec3 HSL = RgbToHsl(vec3(1.0f, 1.0f, 0.5f)); // default values
|
||||
g_Config.m_ClMessageSystemHue = HSL.h;
|
||||
|
@ -1562,7 +1565,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
char name[16];
|
||||
str_copy(name, g_Config.m_PlayerName, sizeof(name));
|
||||
str_format(aBuf, sizeof(aBuf), "*** '%s' entered and joined the spectators", name);
|
||||
while (TextRender()->TextWidth(0, 12.0f, aBuf, -1) > Label.w)
|
||||
while(TextRender()->TextWidth(0, 12.0f, aBuf, -1) > Label.w)
|
||||
{
|
||||
name[str_length(name) - 1] = 0;
|
||||
str_format(aBuf, sizeof(aBuf), "*** '%s' entered and joined the spectators", name);
|
||||
|
@ -1578,7 +1581,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Label, Localize("Highlighted message"), 16.0f, -1);
|
||||
{
|
||||
static int s_DefaultButton = 0;
|
||||
if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
{
|
||||
vec3 HSL = RgbToHsl(vec3(1.0f, 0.5f, 0.5f)); // default values
|
||||
g_Config.m_ClMessageHighlightHue = HSL.h;
|
||||
|
@ -1619,7 +1622,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
char name[16];
|
||||
str_copy(name, g_Config.m_PlayerName, sizeof(name));
|
||||
str_format(aBuf, sizeof(aBuf), ": %s: %s", name, Localize ("Look out!"));
|
||||
while (TextRender()->TextWidth(0, 12.0f, aBuf, -1) > Button.w)
|
||||
while(TextRender()->TextWidth(0, 12.0f, aBuf, -1) > Button.w)
|
||||
{
|
||||
name[str_length(name) - 1] = 0;
|
||||
str_format(aBuf, sizeof(aBuf), ": %s: %s", name, Localize("Look out!"));
|
||||
|
@ -1636,7 +1639,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Label, Localize("Team message"), 16.0f, -1);
|
||||
{
|
||||
static int s_DefaultButton = 0;
|
||||
if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
{
|
||||
vec3 HSL = RgbToHsl(vec3(0.65f, 1.0f, 0.65f)); // default values
|
||||
g_Config.m_ClMessageTeamHue = HSL.h;
|
||||
|
@ -1689,7 +1692,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Label, Localize("Friend message"), 16.0f, -1);
|
||||
{
|
||||
static int s_DefaultButton = 0;
|
||||
if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
{
|
||||
g_Config.m_ClMessageFriendHue = 0;
|
||||
g_Config.m_ClMessageFriendSat = 255;
|
||||
|
@ -1751,7 +1754,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Label, Localize("Normal message"), 16.0f, -1);
|
||||
{
|
||||
static int s_DefaultButton = 0;
|
||||
if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
{
|
||||
vec3 HSL = RgbToHsl(vec3(1.0f, 1.0f, 1.0f)); // default values
|
||||
g_Config.m_ClMessageHue = HSL.h;
|
||||
|
@ -1808,7 +1811,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Label, Localize("Inner color"), 16.0f, -1);
|
||||
{
|
||||
static int s_DefaultButton = 0;
|
||||
if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
{
|
||||
vec3 HSL = RgbToHsl(vec3(0.5f, 0.5f, 1.0f)); // default values
|
||||
g_Config.m_ClLaserInnerHue = HSL.h;
|
||||
|
@ -1844,7 +1847,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Label, Localize("Outline color"), 16.0f, -1);
|
||||
{
|
||||
static int s_DefaultButton = 0;
|
||||
if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
||||
{
|
||||
vec3 HSL = RgbToHsl(vec3(0.075f, 0.075f, 0.25f)); // default values
|
||||
g_Config.m_ClLaserOutlineHue = HSL.h;
|
||||
|
@ -1945,7 +1948,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
Left.HSplitTop(20.0f, &Label, &Left);
|
||||
Button.VSplitRight(20.0f, &Button, 0);
|
||||
char aBuf[64];
|
||||
if (g_Config.m_ClReconnectTimeout == 1)
|
||||
if(g_Config.m_ClReconnectTimeout == 1)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%s %i %s", Localize("Wait before try for"), g_Config.m_ClReconnectTimeout, Localize("second"));
|
||||
}
|
||||
|
@ -1957,7 +1960,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
Left.HSplitTop(20.0f, &Button, 0);
|
||||
Button.HMargin(2.0f, &Button);
|
||||
g_Config.m_ClReconnectTimeout = static_cast<int>(DoScrollbarH(&g_Config.m_ClReconnectTimeout, &Button, g_Config.m_ClReconnectTimeout / 120.0f) * 120.0f);
|
||||
if (g_Config.m_ClReconnectTimeout < 5)
|
||||
if(g_Config.m_ClReconnectTimeout < 5)
|
||||
g_Config.m_ClReconnectTimeout = 5;*/
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ void CUIRect::HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const
|
|||
CUIRect r = *this;
|
||||
Cut *= Scale();
|
||||
|
||||
if (pTop)
|
||||
if(pTop)
|
||||
{
|
||||
pTop->x = r.x;
|
||||
pTop->y = r.y;
|
||||
|
@ -268,7 +268,7 @@ void CUIRect::HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const
|
|||
pTop->h = Cut;
|
||||
}
|
||||
|
||||
if (pBottom)
|
||||
if(pBottom)
|
||||
{
|
||||
pBottom->x = r.x;
|
||||
pBottom->y = r.y + Cut;
|
||||
|
@ -282,7 +282,7 @@ void CUIRect::HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const
|
|||
CUIRect r = *this;
|
||||
Cut *= Scale();
|
||||
|
||||
if (pTop)
|
||||
if(pTop)
|
||||
{
|
||||
pTop->x = r.x;
|
||||
pTop->y = r.y;
|
||||
|
@ -290,7 +290,7 @@ void CUIRect::HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const
|
|||
pTop->h = r.h - Cut;
|
||||
}
|
||||
|
||||
if (pBottom)
|
||||
if(pBottom)
|
||||
{
|
||||
pBottom->x = r.x;
|
||||
pBottom->y = r.y + r.h - Cut;
|
||||
|
@ -306,7 +306,7 @@ void CUIRect::VSplitMid(CUIRect *pLeft, CUIRect *pRight) const
|
|||
float Cut = r.w/2;
|
||||
// Cut *= Scale();
|
||||
|
||||
if (pLeft)
|
||||
if(pLeft)
|
||||
{
|
||||
pLeft->x = r.x;
|
||||
pLeft->y = r.y;
|
||||
|
@ -314,7 +314,7 @@ void CUIRect::VSplitMid(CUIRect *pLeft, CUIRect *pRight) const
|
|||
pLeft->h = r.h;
|
||||
}
|
||||
|
||||
if (pRight)
|
||||
if(pRight)
|
||||
{
|
||||
pRight->x = r.x + Cut;
|
||||
pRight->y = r.y;
|
||||
|
@ -328,7 +328,7 @@ void CUIRect::VSplitLeft(float Cut, CUIRect *pLeft, CUIRect *pRight) const
|
|||
CUIRect r = *this;
|
||||
Cut *= Scale();
|
||||
|
||||
if (pLeft)
|
||||
if(pLeft)
|
||||
{
|
||||
pLeft->x = r.x;
|
||||
pLeft->y = r.y;
|
||||
|
@ -336,7 +336,7 @@ void CUIRect::VSplitLeft(float Cut, CUIRect *pLeft, CUIRect *pRight) const
|
|||
pLeft->h = r.h;
|
||||
}
|
||||
|
||||
if (pRight)
|
||||
if(pRight)
|
||||
{
|
||||
pRight->x = r.x + Cut;
|
||||
pRight->y = r.y;
|
||||
|
@ -350,7 +350,7 @@ void CUIRect::VSplitRight(float Cut, CUIRect *pLeft, CUIRect *pRight) const
|
|||
CUIRect r = *this;
|
||||
Cut *= Scale();
|
||||
|
||||
if (pLeft)
|
||||
if(pLeft)
|
||||
{
|
||||
pLeft->x = r.x;
|
||||
pLeft->y = r.y;
|
||||
|
@ -358,7 +358,7 @@ void CUIRect::VSplitRight(float Cut, CUIRect *pLeft, CUIRect *pRight) const
|
|||
pLeft->h = r.h;
|
||||
}
|
||||
|
||||
if (pRight)
|
||||
if(pRight)
|
||||
{
|
||||
pRight->x = r.x + r.w - Cut;
|
||||
pRight->y = r.y;
|
||||
|
@ -504,19 +504,17 @@ int CUI::DoButton(const void *id, const char *text, int checked, const CUIRect *
|
|||
|
||||
void CUI::DoLabel(const CUIRect *r, const char *pText, float Size, int Align, int MaxWidth)
|
||||
{
|
||||
// TODO: FIX ME!!!!
|
||||
//Graphics()->BlendNormal();
|
||||
if(Align == 0)
|
||||
{
|
||||
float tw = TextRender()->TextWidth(0, Size, pText, MaxWidth);
|
||||
TextRender()->Text(0, r->x + r->w/2-tw/2, r->y - Size/10, Size, pText, MaxWidth);
|
||||
TextRender()->Text(0, r->x + (r->w - tw) / 2.f, r->y + (r->h - Size) / 2.f, Size, pText, MaxWidth);
|
||||
}
|
||||
else if(Align < 0)
|
||||
TextRender()->Text(0, r->x, r->y - Size/10, Size, pText, MaxWidth);
|
||||
TextRender()->Text(0, r->x, r->y + (r->h - Size) / 2.f, Size, pText, MaxWidth);
|
||||
else if(Align > 0)
|
||||
{
|
||||
float tw = TextRender()->TextWidth(0, Size, pText, MaxWidth);
|
||||
TextRender()->Text(0, r->x + r->w-tw, r->y - Size/10, Size, pText, MaxWidth);
|
||||
TextRender()->Text(0, r->x + r->w-tw, r->y + (r->h - Size) / 2.f, Size, pText, MaxWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ void CEditorImage::AnalyseTileFlags()
|
|||
|
||||
int tw = m_Width/16; // tilesizes
|
||||
int th = m_Height/16;
|
||||
if ( tw == th && m_Format == CImageInfo::FORMAT_RGBA )
|
||||
if( tw == th && m_Format == CImageInfo::FORMAT_RGBA )
|
||||
{
|
||||
unsigned char *pPixelData = (unsigned char *)m_pData;
|
||||
|
||||
|
@ -334,7 +334,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
|
|||
{
|
||||
if(UI()->MouseButton(0))
|
||||
{
|
||||
if (UI()->LastActiveItem() != pID)
|
||||
if(UI()->LastActiveItem() != pID)
|
||||
JustGotActive = true;
|
||||
UI()->SetActiveItem(pID);
|
||||
}
|
||||
|
@ -542,12 +542,7 @@ int CEditor::DoButton_Editor(const void *pID, const char *pText, int Checked, co
|
|||
{
|
||||
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_ALL, 3.0f);
|
||||
CUIRect NewRect = *pRect;
|
||||
NewRect.y += NewRect.h/2.0f-7.0f;
|
||||
float tw = min(TextRender()->TextWidth(0, 10.0f, pText, -1), NewRect.w);
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, NewRect.x + NewRect.w/2-tw/2, NewRect.y - 1.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = NewRect.w;
|
||||
TextRender()->TextEx(&Cursor, pText, -1);
|
||||
UI()->DoLabel(&NewRect, pText, 10.f, 0, -1);
|
||||
Checked %= 2;
|
||||
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
|
||||
}
|
||||
|
@ -559,13 +554,7 @@ int CEditor::DoButton_Env(const void *pID, const char *pText, int Checked, const
|
|||
vec4 Color = vec4(BaseColor.r*Bright, BaseColor.g*Bright, BaseColor.b*Bright, Alpha);
|
||||
|
||||
RenderTools()->DrawUIRect(pRect, Color, CUI::CORNER_ALL, 3.0f);
|
||||
CUIRect NewRect = *pRect;
|
||||
NewRect.y += NewRect.h/2.0f-7.0f;
|
||||
float tw = min(TextRender()->TextWidth(0, 10.0f, pText, -1), NewRect.w);
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, NewRect.x + NewRect.w/2-tw/2, NewRect.y - 1.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = NewRect.w;
|
||||
TextRender()->TextEx(&Cursor, pText, -1);
|
||||
UI()->DoLabel(pRect, pText, 10.f, 0, -1);
|
||||
Checked %= 2;
|
||||
return DoButton_Editor_Common(pID, pText, Checked, pRect, 0, pToolTip);
|
||||
}
|
||||
|
@ -599,10 +588,7 @@ int CEditor::DoButton_MenuItem(const void *pID, const char *pText, int Checked,
|
|||
|
||||
CUIRect t = *pRect;
|
||||
t.VMargin(5.0f, &t);
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, t.x, t.y - 1.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = t.w;
|
||||
TextRender()->TextEx(&Cursor, pText, -1);
|
||||
UI()->DoLabel(&t, pText, 10, 0, -1);
|
||||
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
|
||||
}
|
||||
|
||||
|
@ -610,7 +596,6 @@ int CEditor::DoButton_Tab(const void *pID, const char *pText, int Checked, const
|
|||
{
|
||||
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_T, 5.0f);
|
||||
CUIRect NewRect = *pRect;
|
||||
NewRect.y += NewRect.h/2.0f-7.0f;
|
||||
UI()->DoLabel(&NewRect, pText, 10, 0, -1);
|
||||
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
|
||||
}
|
||||
|
@ -619,7 +604,6 @@ int CEditor::DoButton_Ex(const void *pID, const char *pText, int Checked, const
|
|||
{
|
||||
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), Corners, 3.0f);
|
||||
CUIRect NewRect = *pRect;
|
||||
NewRect.HMargin(NewRect.h/2.0f-FontSize/2.0f-1.0f, &NewRect);
|
||||
UI()->DoLabel(&NewRect, pText, FontSize, 0, -1);
|
||||
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
|
||||
}
|
||||
|
@ -804,7 +788,6 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
|
|||
else
|
||||
str_format(aBuf, sizeof(aBuf),"%d", Current);
|
||||
RenderTools()->DrawUIRect(pRect, Color ? *Color : GetButtonColor(pID, 0), Corners, 5.0f);
|
||||
pRect->y += pRect->h/2.0f-7.0f;
|
||||
UI()->DoLabel(pRect, aBuf, 10, 0, -1);
|
||||
}
|
||||
|
||||
|
@ -2234,7 +2217,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
|
|||
pEditLayers[0] = &m_TilesetPicker;
|
||||
NumEditLayers++;
|
||||
}
|
||||
else if (m_ShowPicker)
|
||||
else if(m_ShowPicker)
|
||||
{
|
||||
pEditLayers[0] = &m_QuadsetPicker;
|
||||
NumEditLayers++;
|
||||
|
@ -2642,7 +2625,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
|
|||
}
|
||||
}
|
||||
|
||||
if (!m_ShowPicker && m_ShowTileInfo && m_ShowEnvelopePreview != 0 && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_QUADS)
|
||||
if(!m_ShowPicker && m_ShowTileInfo && m_ShowEnvelopePreview != 0 && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_QUADS)
|
||||
{
|
||||
GetSelectedGroup()->MapScreen();
|
||||
|
||||
|
@ -2682,7 +2665,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
Shifter.VSplitLeft(10.0f, &Dec, &Shifter);
|
||||
str_format(aBuf, sizeof(aBuf),"%d", pProps[i].m_Value);
|
||||
int NewValue = UiDoValueSelector((char *) &pIDs[i], &Shifter, "", pProps[i].m_Value, pProps[i].m_Min, pProps[i].m_Max, 1, 1.0f, "Use left mouse button to drag and change the value. Hold shift to be more precise. Rightclick to edit as text.", false, false, 0, &Color);
|
||||
if (NewValue != pProps[i].m_Value)
|
||||
if(NewValue != pProps[i].m_Value)
|
||||
{
|
||||
*pNewVal = NewValue;
|
||||
Change = i;
|
||||
|
@ -2730,7 +2713,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
bool Shift = Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT);
|
||||
int Value = pProps[i].m_Value;
|
||||
const void *activeItem = UI()->ActiveItem();
|
||||
if (!Shift && UI()->MouseButton(0) && (activeItem == &pIDs[i] || activeItem == &pIDs[i]+1 || activeItem == &pIDs[i]+2))
|
||||
if(!Shift && UI()->MouseButton(0) && (activeItem == &pIDs[i] || activeItem == &pIDs[i]+1 || activeItem == &pIDs[i]+2))
|
||||
Value = (Value / 45) * 45;
|
||||
int NewValue = UiDoValueSelector(&pIDs[i], &Shifter, "", Value, pProps[i].m_Min, Shift ? pProps[i].m_Max : 315, Shift ? 1 : 45, Shift ? 1.0f : 10.0f, "Use left mouse button to drag and change the value. Hold shift to be more precise. Rightclick to edit as text.", false, false, 0);
|
||||
if(NewValue != pProps[i].m_Value)
|
||||
|
@ -2738,17 +2721,17 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
*pNewVal = NewValue;
|
||||
Change = i;
|
||||
}
|
||||
if (DoButton_ButtonDec(&pIDs[i]+1, 0, 0, &Dec, 0, "Decrease"))
|
||||
if(DoButton_ButtonDec(&pIDs[i]+1, 0, 0, &Dec, 0, "Decrease"))
|
||||
{
|
||||
if (!Shift)
|
||||
if(!Shift)
|
||||
*pNewVal = pProps[i].m_Value - 45;
|
||||
else
|
||||
*pNewVal = pProps[i].m_Value - 1;
|
||||
Change = i;
|
||||
}
|
||||
if (DoButton_ButtonInc(&pIDs[i]+ 2, 0, 0, &Inc, 0, "Increase"))
|
||||
if(DoButton_ButtonInc(&pIDs[i]+ 2, 0, 0, &Inc, 0, "Increase"))
|
||||
{
|
||||
if (!Shift)
|
||||
if(!Shift)
|
||||
*pNewVal = pProps[i].m_Value + 45;
|
||||
else
|
||||
*pNewVal = pProps[i].m_Value + 1;
|
||||
|
@ -3795,7 +3778,7 @@ void CEditor::RenderFileDialog()
|
|||
View.HSplitBottom(14.0f, &View, &FileBox);
|
||||
FileBox.VSplitLeft(55.0f, &FileBoxLabel, &FileBox);
|
||||
View.HSplitBottom(10.0f, &View, 0); // some spacing
|
||||
if (m_FileDialogFileType == CEditor::FILETYPE_IMG)
|
||||
if(m_FileDialogFileType == CEditor::FILETYPE_IMG)
|
||||
View.VSplitMid(&View, &Preview);
|
||||
View.VSplitRight(15.0f, &View, &Scroll);
|
||||
|
||||
|
@ -3843,7 +3826,7 @@ void CEditor::RenderFileDialog()
|
|||
static int s_ClearButton = 0;
|
||||
RenderTools()->DrawUIRect(&ClearBox, vec4(1, 1, 1, 0.33f)*ButtonColorMul(&s_ClearButton), CUI::CORNER_R, 3.0f);
|
||||
UI()->DoLabel(&ClearBox, "×", 10.0f, 0);
|
||||
if (UI()->DoButtonLogic(&s_ClearButton, "×", 0, &ClearBox))
|
||||
if(UI()->DoButtonLogic(&s_ClearButton, "×", 0, &ClearBox))
|
||||
{
|
||||
m_aFileDialogSearchText[0] = 0;
|
||||
UI()->SetActiveItem(&s_SearchBoxID);
|
||||
|
@ -3899,10 +3882,10 @@ void CEditor::RenderFileDialog()
|
|||
}
|
||||
}
|
||||
|
||||
if (m_FileDialogFileType == CEditor::FILETYPE_IMG && m_FilePreviewImage == 0 && m_FilesSelectedIndex > -1)
|
||||
if(m_FileDialogFileType == CEditor::FILETYPE_IMG && m_FilePreviewImage == 0 && m_FilesSelectedIndex > -1)
|
||||
{
|
||||
int Length = str_length(m_FileList[m_FilesSelectedIndex].m_aFilename);
|
||||
if (Length >= 4 && !str_comp(m_FileList[m_FilesSelectedIndex].m_aFilename+Length-4, ".png"))
|
||||
if(Length >= 4 && !str_comp(m_FileList[m_FilesSelectedIndex].m_aFilename+Length-4, ".png"))
|
||||
{
|
||||
char aBuffer[1024];
|
||||
str_format(aBuffer, sizeof(aBuffer), "%s/%s", m_pFileDialogPath, m_FileList[m_FilesSelectedIndex].m_aFilename);
|
||||
|
@ -3914,16 +3897,16 @@ void CEditor::RenderFileDialog()
|
|||
}
|
||||
}
|
||||
}
|
||||
if (m_FilePreviewImage)
|
||||
if(m_FilePreviewImage)
|
||||
{
|
||||
int w = m_FilePreviewImageInfo.m_Width;
|
||||
int h = m_FilePreviewImageInfo.m_Height;
|
||||
if (m_FilePreviewImageInfo.m_Width > Preview.w)
|
||||
if(m_FilePreviewImageInfo.m_Width > Preview.w)
|
||||
{
|
||||
h = m_FilePreviewImageInfo.m_Height * Preview.w / m_FilePreviewImageInfo.m_Width;
|
||||
w = Preview.w;
|
||||
}
|
||||
if (h > Preview.h)
|
||||
if(h > Preview.h)
|
||||
{
|
||||
w = w * Preview.h / h,
|
||||
h = Preview.h;
|
||||
|
@ -3962,7 +3945,7 @@ void CEditor::RenderFileDialog()
|
|||
UI()->ClipEnable(&View);
|
||||
|
||||
for(int i = 0; i < m_FileList.size(); i++)
|
||||
if (!m_aFileDialogSearchText[0] || str_find_nocase (m_FileList[i].m_aName, m_aFileDialogSearchText))
|
||||
if(!m_aFileDialogSearchText[0] || str_find_nocase (m_FileList[i].m_aName, m_aFileDialogSearchText))
|
||||
AddFileDialogEntry(i, &View);
|
||||
|
||||
// disable clipping again
|
||||
|
@ -4141,7 +4124,7 @@ void CEditor::RenderModebar(CUIRect View)
|
|||
int MouseButton = DoButton_Tab(&s_Button, pButName, 0, &Button, 0, "Switch between images, sounds and layers management.");
|
||||
if(MouseButton == 2)
|
||||
{
|
||||
if (m_Mode == MODE_LAYERS)
|
||||
if(m_Mode == MODE_LAYERS)
|
||||
m_Mode = MODE_SOUNDS;
|
||||
else if(m_Mode == MODE_IMAGES)
|
||||
m_Mode = MODE_LAYERS;
|
||||
|
@ -4150,7 +4133,7 @@ void CEditor::RenderModebar(CUIRect View)
|
|||
}
|
||||
else if(MouseButton == 1)
|
||||
{
|
||||
if (m_Mode == MODE_LAYERS)
|
||||
if(m_Mode == MODE_LAYERS)
|
||||
m_Mode = MODE_IMAGES;
|
||||
else if(m_Mode == MODE_IMAGES)
|
||||
m_Mode = MODE_SOUNDS;
|
||||
|
@ -4187,7 +4170,7 @@ void CEditor::RenderStatusbar(CUIRect View)
|
|||
m_ShowServerSettingsEditor ^= 1;
|
||||
}
|
||||
|
||||
if (g_Config.m_ClEditorUndo)
|
||||
if(g_Config.m_ClEditorUndo)
|
||||
{
|
||||
View.VSplitRight(5.0f, &View, &Button);
|
||||
View.VSplitRight(60.0f, &View, &Button);
|
||||
|
@ -4225,23 +4208,23 @@ void CEditor::RenderUndoList(CUIRect View)
|
|||
int ClickedIndex = -1;
|
||||
int HoveredIndex = -1;
|
||||
int ScrollNum = m_lUndoSteps.size() - List.h / 17.0f;
|
||||
if (ScrollNum < 0)
|
||||
if(ScrollNum < 0)
|
||||
ScrollNum = 0;
|
||||
List.y -= m_UndoScrollValue*ScrollNum*17.0f;
|
||||
for (int i = 0; i < m_lUndoSteps.size(); i++)
|
||||
for(int i = 0; i < m_lUndoSteps.size(); i++)
|
||||
{
|
||||
List.HSplitTop(17.0f, &Button, &List);
|
||||
if (List.y < TopY)
|
||||
if(List.y < TopY)
|
||||
continue;
|
||||
if (List.y - 17.0f > TopY + Height)
|
||||
if(List.y - 17.0f > TopY + Height)
|
||||
break;
|
||||
if(DoButton_Editor(&m_lUndoSteps[i].m_ButtonId, m_lUndoSteps[i].m_aName, 0, &Button, 0, "Undo to this step"))
|
||||
ClickedIndex = i;
|
||||
if (UI()->HotItem() == &m_lUndoSteps[i].m_ButtonId)
|
||||
if(UI()->HotItem() == &m_lUndoSteps[i].m_ButtonId)
|
||||
HoveredIndex = i;
|
||||
}
|
||||
UI()->ClipDisable();
|
||||
if (ClickedIndex != -1)
|
||||
if(ClickedIndex != -1)
|
||||
{
|
||||
char aBuffer[1024];
|
||||
str_format(aBuffer, sizeof(aBuffer), "editor/undo_%i", m_lUndoSteps[HoveredIndex].m_FileNum);
|
||||
|
@ -4249,15 +4232,15 @@ void CEditor::RenderUndoList(CUIRect View)
|
|||
m_Map.m_UndoModified = 0;
|
||||
m_LastUndoUpdateTime = time_get();
|
||||
}
|
||||
if (HoveredIndex != -1)
|
||||
if(HoveredIndex != -1)
|
||||
{
|
||||
if (m_lUndoSteps[HoveredIndex].m_PreviewImage == 0)
|
||||
if(m_lUndoSteps[HoveredIndex].m_PreviewImage == 0)
|
||||
{
|
||||
char aBuffer[1024];
|
||||
str_format(aBuffer, sizeof(aBuffer), "editor/undo_%i.png", m_lUndoSteps[HoveredIndex].m_FileNum);
|
||||
m_lUndoSteps[HoveredIndex].m_PreviewImage = Graphics()->LoadTexture(aBuffer, IStorage::TYPE_SAVE, CImageInfo::FORMAT_RGB, IGraphics::TEXLOAD_NORESAMPLE);
|
||||
}
|
||||
if (m_lUndoSteps[HoveredIndex].m_PreviewImage)
|
||||
if(m_lUndoSteps[HoveredIndex].m_PreviewImage)
|
||||
{
|
||||
Graphics()->TextureSet(m_lUndoSteps[HoveredIndex].m_PreviewImage);
|
||||
Graphics()->BlendNormal();
|
||||
|
@ -4683,7 +4666,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
pEnvelope->m_lPoints[i].m_aValues[c] -= f2fx(m_MouseDeltaY*ValueScale);
|
||||
}
|
||||
|
||||
if (m_SelectedEnvelopePoint != i)
|
||||
if(m_SelectedEnvelopePoint != i)
|
||||
m_Map.m_UndoModified++;
|
||||
|
||||
m_SelectedQuadEnvelope = m_SelectedEnvelope;
|
||||
|
@ -4758,7 +4741,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
str_format(s_aStrCurValue, sizeof(s_aStrCurValue), "%.3f", fx2f(CurrentValue));
|
||||
}
|
||||
|
||||
if (m_SelectedQuadEnvelope == m_SelectedEnvelope && m_SelectedEnvelopePoint == i)
|
||||
if(m_SelectedQuadEnvelope == m_SelectedEnvelope && m_SelectedEnvelopePoint == i)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
else
|
||||
Graphics()->SetColor(aColors[c].r*ColorMod, aColors[c].g*ColorMod, aColors[c].b*ColorMod, 1.0f);
|
||||
|
@ -4775,7 +4758,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
CUIRect ToolBar2;
|
||||
|
||||
ToolBar.VSplitMid(&ToolBar1, &ToolBar2);
|
||||
if (ToolBar.w > ToolBar.h * 21)
|
||||
if(ToolBar.w > ToolBar.h * 21)
|
||||
{
|
||||
ToolBar1.VMargin(3.0f, &ToolBar1);
|
||||
ToolBar2.VMargin(3.0f, &ToolBar2);
|
||||
|
@ -5118,7 +5101,7 @@ void CEditor::Render()
|
|||
Size *= 3.0f;
|
||||
View.HSplitBottom(Size, &View, &ExtraEditor);
|
||||
}
|
||||
if (m_ShowUndo && !m_ShowPicker)
|
||||
if(m_ShowUndo && !m_ShowPicker)
|
||||
{
|
||||
View.HSplitBottom(250.0f, &View, &UndoList);
|
||||
}
|
||||
|
@ -5287,7 +5270,7 @@ void CEditor::Render()
|
|||
static int UndoStepsListdirCallback(const char *pName, int IsDir, int StorageType, void *pUser)
|
||||
{
|
||||
IStorage *pStorage = (IStorage *)pUser;
|
||||
if (str_comp_nocase_num(pName, "undo_", 5) == 0)
|
||||
if(str_comp_nocase_num(pName, "undo_", 5) == 0)
|
||||
{
|
||||
char aBuffer[1024];
|
||||
pStorage->GetCompletePath(IStorage::TYPE_SAVE, "editor/", aBuffer, sizeof(aBuffer));
|
||||
|
@ -5505,8 +5488,7 @@ void CEditor::Init()
|
|||
m_pTextRender = Kernel()->RequestInterface<ITextRender>();
|
||||
m_pStorage = Kernel()->RequestInterface<IStorage>();
|
||||
m_pSound = Kernel()->RequestInterface<ISound>();
|
||||
m_RenderTools.m_pGraphics = m_pGraphics;
|
||||
m_RenderTools.m_pUI = &m_UI;
|
||||
m_RenderTools.Init(m_pGraphics, &m_UI);
|
||||
m_UI.SetGraphics(m_pGraphics, m_pTextRender);
|
||||
m_Map.m_pEditor = this;
|
||||
|
||||
|
@ -5568,7 +5550,7 @@ void CEditor::CreateUndoStepThread(void *pUser)
|
|||
|
||||
CUndo NewStep;
|
||||
str_timestamp(NewStep.m_aName, sizeof(NewStep.m_aName));
|
||||
if (pEditor->m_lUndoSteps.size())
|
||||
if(pEditor->m_lUndoSteps.size())
|
||||
NewStep.m_FileNum = pEditor->m_lUndoSteps[pEditor->m_lUndoSteps.size() - 1].m_FileNum + 1;
|
||||
else
|
||||
NewStep.m_FileNum = 0;
|
||||
|
@ -5675,16 +5657,16 @@ void CEditor::UpdateAndRender()
|
|||
if(Input()->KeyPress(KEY_F10))
|
||||
m_ShowMousePointer = false;
|
||||
|
||||
if (g_Config.m_ClEditorUndo)
|
||||
if(g_Config.m_ClEditorUndo)
|
||||
{
|
||||
// Screenshot at most every 5 seconds, at least every 60
|
||||
if ((m_LastUndoUpdateTime + time_freq() * 60 < time_get() && m_Map.m_UndoModified)
|
||||
if((m_LastUndoUpdateTime + time_freq() * 60 < time_get() && m_Map.m_UndoModified)
|
||||
|| (m_LastUndoUpdateTime + time_freq() * 5 < time_get() && m_Map.m_UndoModified >= 10))
|
||||
{
|
||||
m_Map.m_UndoModified = 0;
|
||||
m_LastUndoUpdateTime = time_get();
|
||||
|
||||
if (!m_UndoRunning)
|
||||
if(!m_UndoRunning)
|
||||
{
|
||||
m_UndoRunning = true;
|
||||
CreateUndoStep();
|
||||
|
|
Loading…
Reference in a new issue