diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index e1a3283dc..5235339a3 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -32,14 +32,6 @@ #include "menus.h" #include "skins.h" -vec4 CMenus::ms_GuiColor; -vec4 CMenus::ms_ColorTabbarInactiveOutgame; -vec4 CMenus::ms_ColorTabbarActiveOutgame; -vec4 CMenus::ms_ColorTabbarInactive; -vec4 CMenus::ms_ColorTabbarActive = vec4(0,0,0,0.5f); -vec4 CMenus::ms_ColorTabbarInactiveIngame; -vec4 CMenus::ms_ColorTabbarActiveIngame; - float CMenus::ms_ButtonHeight = 25.0f; float CMenus::ms_ListheaderHeight = 17.0f; float CMenus::ms_FontmodHeight = 0.8f; @@ -195,10 +187,10 @@ void CMenus::DoButton_KeySelect(const void *pID, const char *pText, int Checked, int CMenus::DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners) { if(Checked) - RenderTools()->DrawUIRect(pRect, ms_ColorTabbarActive, Corners, 10.0f); + RenderTools()->DrawUIRect(pRect, vec4(1.0f, 1.0f, 1.0f, 0.25f), Corners, 10.0f); else { - RenderTools()->DrawUIRect(pRect, ms_ColorTabbarInactive, Corners, 10.0f); + RenderTools()->DrawUIRect(pRect, vec4(0.0f, 0.0f, 0.0f, 0.25f), Corners, 10.0f); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 0.7f); } @@ -912,10 +904,6 @@ void CMenus::RenderLoading() LastLoadRender = time_get(); - // need up date this here to get correct - vec3 Rgb = HslToRgb(vec3(g_Config.m_UiColorHue/255.0f, g_Config.m_UiColorSat/255.0f, g_Config.m_UiColorLht/255.0f)); - ms_GuiColor = vec4(Rgb.r, Rgb.g, Rgb.b, g_Config.m_UiColorAlpha/255.0f); - CUIRect Screen = *UI()->Screen(); Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h); @@ -955,7 +943,7 @@ void CMenus::RenderLoading() void CMenus::RenderNews(CUIRect MainView) { - RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&MainView, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f); } int CMenus::MenuImageScan(const char *pName, int IsDir, int DirType, void *pUser) @@ -1150,17 +1138,9 @@ int CMenus::Render() s_First = false; } - if(Client()->State() == IClient::STATE_ONLINE || m_pClient->m_pMapLayersBackGround->MenuMapLoaded()) - { - ms_ColorTabbarInactive = ms_ColorTabbarInactiveIngame; - ms_ColorTabbarActive = ms_ColorTabbarActiveIngame; - } - else - { + // render background only if needed + if(Client()->State() != IClient::STATE_ONLINE && !m_pClient->m_pMapLayersBackGround->MenuMapLoaded()) RenderBackground(); - ms_ColorTabbarInactive = ms_ColorTabbarInactiveOutgame; - ms_ColorTabbarActive = ms_ColorTabbarActiveOutgame; - } CUIRect TabBar; CUIRect MainView; @@ -1911,27 +1891,6 @@ void CMenus::OnRender() return; } - // update colors - vec3 Rgb = HslToRgb(vec3(g_Config.m_UiColorHue/255.0f, g_Config.m_UiColorSat/255.0f, g_Config.m_UiColorLht/255.0f)); - ms_GuiColor = vec4(Rgb.r, Rgb.g, Rgb.b, g_Config.m_UiColorAlpha/255.0f); - - ms_ColorTabbarInactiveOutgame = vec4(0,0,0,0.25f); - ms_ColorTabbarActiveOutgame = vec4(0,0,0,0.5f); - - float ColorIngameScaleI = 0.5f; - float ColorIngameAcaleA = 0.2f; - ms_ColorTabbarInactiveIngame = vec4( - ms_GuiColor.r*ColorIngameScaleI, - ms_GuiColor.g*ColorIngameScaleI, - ms_GuiColor.b*ColorIngameScaleI, - ms_GuiColor.a*0.8f); - - ms_ColorTabbarActiveIngame = vec4( - ms_GuiColor.r*ColorIngameAcaleA, - ms_GuiColor.g*ColorIngameAcaleA, - ms_GuiColor.b*ColorIngameAcaleA, - ms_GuiColor.a); - // update the ui CUIRect *pScreen = UI()->Screen(); float mx = (m_MousePos.x/(float)Graphics()->ScreenWidth())*pScreen->w; @@ -1997,8 +1956,8 @@ void CMenus::RenderBackground() Graphics()->QuadsBegin(); //vec4 bottom(gui_color.r*0.3f, gui_color.g*0.3f, gui_color.b*0.3f, 1.0f); //vec4 bottom(0, 0, 0, 1.0f); - vec4 Bottom(ms_GuiColor.r, ms_GuiColor.g, ms_GuiColor.b, 1.0f); - vec4 Top(ms_GuiColor.r, ms_GuiColor.g, ms_GuiColor.b, 1.0f); + vec4 Bottom(0.25f, 0.25f, 0.25f, 1.0f); + vec4 Top(0.25f, 0.25f, 0.25f, 1.0f); IGraphics::CColorVertex Array[4] = { IGraphics::CColorVertex(0, Top.r, Top.g, Top.b, Top.a), IGraphics::CColorVertex(1, Top.r, Top.g, Top.b, Top.a), diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 1efe7016c..edc0cc215 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -40,14 +40,6 @@ enum class CMenus : public CComponent { - static vec4 ms_GuiColor; - static vec4 ms_ColorTabbarInactiveOutgame; - static vec4 ms_ColorTabbarActiveOutgame; - static vec4 ms_ColorTabbarInactiveIngame; - static vec4 ms_ColorTabbarActiveIngame; - static vec4 ms_ColorTabbarInactive; - static vec4 ms_ColorTabbarActive; - float *ButtonFade(const void *pID, float Seconds, int Checked=0); diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index dedafd890..6c1f3b436 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -1302,7 +1302,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView) CUIRect ServerList, ToolBox, ConnectBox; // background - RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 12.0f); + RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 12.0f); MainView.Margin(10.0f, &MainView); // create server list, status box, tab bar and tool box area diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index bd8305afc..d5df68ae2 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -65,7 +65,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) MainView.VSplitLeft(50.0f, 0, &MainView); MainView.VSplitRight(450.0f, &MainView, 0); - RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_T, 10.0f); + RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_T, 10.0f); MainView.Margin(5.0f, &MainView); @@ -537,7 +537,7 @@ void CMenus::RenderDemoList(CUIRect MainView) } // render background - RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 10.0f); MainView.Margin(10.0f, &MainView); CUIRect ButtonBar, RefreshRect, PlayRect, DeleteRect, RenameRect, FileIcon, ListBox; diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 2aa2c482f..6d320c4a8 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -26,7 +26,7 @@ void CMenus::RenderGame(CUIRect MainView) { CUIRect Button, ButtonBar; MainView.HSplitTop(45.0f, &ButtonBar, &MainView); - RenderTools()->DrawUIRect(&ButtonBar, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&ButtonBar, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 10.0f); // button bar ButtonBar.HSplitTop(10.0f, 0, &ButtonBar); @@ -108,7 +108,7 @@ void CMenus::RenderGame(CUIRect MainView) void CMenus::RenderPlayers(CUIRect MainView) { CUIRect Button, ButtonBar, Options, Player; - RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 10.0f); // player options MainView.Margin(10.0f, &Options); @@ -212,7 +212,7 @@ void CMenus::RenderServerInfo(CUIRect MainView) Client()->GetServerInfo(&CurrentServerInfo); // render background - RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 10.0f); CUIRect View, ServerInfo, GameInfo, Motd; @@ -379,9 +379,9 @@ void CMenus::RenderServerControl(CUIRect MainView) // render background CUIRect Bottom, Extended, TabBar, Button; MainView.HSplitTop(20.0f, &Bottom, &MainView); - RenderTools()->DrawUIRect(&Bottom, ms_ColorTabbarActive, CUI::CORNER_T, 10.0f); + RenderTools()->DrawUIRect(&Bottom, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_T, 10.0f); MainView.HSplitTop(20.0f, &TabBar, &MainView); - RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_B, 10.0f); + RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_B, 10.0f); MainView.Margin(10.0f, &MainView); MainView.HSplitBottom(90.0f, &MainView, &Extended); diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 520e4571d..2d4b52224 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -1418,36 +1418,6 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) else m_NeedRestartGraphics = true; } - - // - - CUIRect Text; - MainView.HSplitTop(20.0f, 0, &MainView); - MainView.HSplitTop(20.0f, &Text, &MainView); - //text.VSplitLeft(15.0f, 0, &text); - UI()->DoLabelScaled(&Text, Localize("UI Color"), 14.0f, -1); - - const char *paLabels[] = { - Localize("Hue"), - Localize("Sat."), - Localize("Lht."), - Localize("Alpha")}; - int *pColorSlider[4] = {&g_Config.m_UiColorHue, &g_Config.m_UiColorSat, &g_Config.m_UiColorLht, &g_Config.m_UiColorAlpha}; - static int s_aColorSliders[4] = {0}; - for(int s = 0; s < 4; s++) - { - CUIRect Text; - MainView.HSplitTop(19.0f, &Button, &MainView); - Button.VMargin(15.0f, &Button); - Button.VSplitLeft(100.0f, &Text, &Button); - //Button.VSplitRight(5.0f, &Button, 0); - Button.HSplitTop(4.0f, 0, &Button); - - float k = (*pColorSlider[s]) / 255.0f; - k = DoScrollbarH(&s_aColorSliders[s], &Button, k); - *pColorSlider[s] = (int)(k*255.0f); - UI()->DoLabelScaled(&Text, paLabels[s], 15.0f, -1); - } } void CMenus::RenderSettingsSound(CUIRect MainView) @@ -1524,7 +1494,7 @@ void CMenus::RenderSettings(CUIRect MainView) { CUIRect RestartWarning; MainView.HSplitBottom(15.0f, &MainView, &RestartWarning); - RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 10.0f); MainView.HSplitTop(10.0f, 0, &MainView); diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp index 134a1bc97..cdb08b466 100644 --- a/src/game/client/ui.cpp +++ b/src/game/client/ui.cpp @@ -79,19 +79,14 @@ float CUI::PixelSize() return Screen()->w/Graphics()->ScreenWidth(); } -void CUI::SetScale(float s) -{ - g_Config.m_UiScale = (int)(s*100.0f); -} - float CUI::Scale() { - return g_Config.m_UiScale/100.0f; + return 1.0f; } float CUIRect::Scale() const { - return g_Config.m_UiScale/100.0f; + return 1.0f; } void CUI::ClipEnable(const CUIRect *r) diff --git a/src/game/client/ui.h b/src/game/client/ui.h index 917ea8dfe..69436bdc7 100644 --- a/src/game/client/ui.h +++ b/src/game/client/ui.h @@ -97,7 +97,6 @@ public: void ClipDisable(); // TODO: Refactor: Redo UI scaling - void SetScale(float s); float Scale(); int DoButtonLogic(const void *pID, const char *pText /* TODO: Refactor: Remove */, int Checked, const CUIRect *pRect); diff --git a/src/game/variables.h b/src/game/variables.h index 582293047..e1eca96cb 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -64,14 +64,8 @@ MACRO_CONFIG_INT(UiBrowserPage, ui_browser_page, 6, 6, 8, CFGFLAG_CLIENT|CFGFLAG MACRO_CONFIG_INT(UiSettingsPage, ui_settings_page, 0, 0, 4, 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_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address") -MACRO_CONFIG_INT(UiScale, ui_scale, 100, 50, 150, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale") MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor") -MACRO_CONFIG_INT(UiColorHue, ui_color_hue, 160, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color hue") -MACRO_CONFIG_INT(UiColorSat, ui_color_sat, 70, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color saturation") -MACRO_CONFIG_INT(UiColorLht, ui_color_lht, 175, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color lightness") -MACRO_CONFIG_INT(UiColorAlpha, ui_color_alpha, 228, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface alpha") - MACRO_CONFIG_INT(GfxNoclip, gfx_noclip, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Disable clipping") MACRO_CONFIG_STR(ClBackgroundMap, cl_background_map, 64, "menu_night", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background map")