Extract CMenus::UpdateColors function

This commit is contained in:
Robert Müller 2023-06-04 12:26:51 +02:00
parent 878eedeed7
commit 322e06e4a5
2 changed files with 28 additions and 23 deletions

View file

@ -2309,29 +2309,7 @@ void CMenus::OnRender()
return;
}
// update colors
ms_GuiColor = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_UiColor, true));
ms_ColorTabbarInactiveOutgame = ColorRGBA(0, 0, 0, 0.25f);
ms_ColorTabbarActiveOutgame = ColorRGBA(0, 0, 0, 0.5f);
ms_ColorTabbarHoverOutgame = ColorRGBA(1, 1, 1, 0.25f);
float ColorIngameScaleI = 0.5f;
float ColorIngameAcaleA = 0.2f;
ms_ColorTabbarInactiveIngame = ColorRGBA(
ms_GuiColor.r * ColorIngameScaleI,
ms_GuiColor.g * ColorIngameScaleI,
ms_GuiColor.b * ColorIngameScaleI,
ms_GuiColor.a * 0.8f);
ms_ColorTabbarActiveIngame = ColorRGBA(
ms_GuiColor.r * ColorIngameAcaleA,
ms_GuiColor.g * ColorIngameAcaleA,
ms_GuiColor.b * ColorIngameAcaleA,
ms_GuiColor.a);
ms_ColorTabbarHoverIngame = ColorRGBA(1, 1, 1, 0.75f);
UpdateColors();
// update the ui
const CUIRect *pScreen = UI()->Screen();
@ -2362,6 +2340,32 @@ void CMenus::OnRender()
UI()->ClearHotkeys();
}
void CMenus::UpdateColors()
{
ms_GuiColor = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_UiColor, true));
ms_ColorTabbarInactiveOutgame = ColorRGBA(0.0f, 0.0f, 0.0f, 0.25f);
ms_ColorTabbarActiveOutgame = ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f);
ms_ColorTabbarHoverOutgame = ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f);
const float ColorIngameScaleI = 0.5f;
const float ColorIngameAcaleA = 0.2f;
ms_ColorTabbarInactiveIngame = ColorRGBA(
ms_GuiColor.r * ColorIngameScaleI,
ms_GuiColor.g * ColorIngameScaleI,
ms_GuiColor.b * ColorIngameScaleI,
ms_GuiColor.a * 0.8f);
ms_ColorTabbarActiveIngame = ColorRGBA(
ms_GuiColor.r * ColorIngameAcaleA,
ms_GuiColor.g * ColorIngameAcaleA,
ms_GuiColor.b * ColorIngameAcaleA,
ms_GuiColor.a);
ms_ColorTabbarHoverIngame = ColorRGBA(1.0f, 1.0f, 1.0f, 0.75f);
}
void CMenus::RenderBackground()
{
Graphics()->BlendNormal();

View file

@ -509,6 +509,7 @@ protected:
void SetNeedSendInfo();
void SetActive(bool Active);
void UpdateColors();
IGraphics::CTextureHandle m_TextureBlob;