mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
added a slight background to the menus
This commit is contained in:
parent
b2a93432e5
commit
001921242b
|
@ -35,6 +35,7 @@
|
||||||
float CMenus::ms_ButtonHeight = 25.0f;
|
float CMenus::ms_ButtonHeight = 25.0f;
|
||||||
float CMenus::ms_ListheaderHeight = 17.0f;
|
float CMenus::ms_ListheaderHeight = 17.0f;
|
||||||
float CMenus::ms_FontmodHeight = 0.8f;
|
float CMenus::ms_FontmodHeight = 0.8f;
|
||||||
|
float CMenus::ms_BackgroundAlpha = 0.25f;
|
||||||
|
|
||||||
|
|
||||||
CMenus::CMenus()
|
CMenus::CMenus()
|
||||||
|
|
|
@ -220,6 +220,7 @@ private:
|
||||||
static float ms_ButtonHeight;
|
static float ms_ButtonHeight;
|
||||||
static float ms_ListheaderHeight;
|
static float ms_ListheaderHeight;
|
||||||
static float ms_FontmodHeight;
|
static float ms_FontmodHeight;
|
||||||
|
static float ms_BackgroundAlpha;
|
||||||
|
|
||||||
// for settings
|
// for settings
|
||||||
bool m_NeedRestartGraphics;
|
bool m_NeedRestartGraphics;
|
||||||
|
|
|
@ -320,6 +320,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
||||||
|
|
||||||
// cut view
|
// cut view
|
||||||
MainView.HSplitBottom(80.0f, &MainView, &BottomView);
|
MainView.HSplitBottom(80.0f, &MainView, &BottomView);
|
||||||
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f);
|
||||||
BottomView.HSplitTop(20.f, 0, &BottomView);
|
BottomView.HSplitTop(20.f, 0, &BottomView);
|
||||||
|
|
||||||
static int s_Inited = 0;
|
static int s_Inited = 0;
|
||||||
|
|
|
@ -685,6 +685,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
|
||||||
float BackgroundHeight = (float)(NumOptions+1)*ButtonHeight+(float)NumOptions*Spacing;
|
float BackgroundHeight = (float)(NumOptions+1)*ButtonHeight+(float)NumOptions*Spacing;
|
||||||
|
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f);
|
||||||
MainView.HSplitTop(BackgroundHeight, &Game, &MainView);
|
MainView.HSplitTop(BackgroundHeight, &Game, &MainView);
|
||||||
RenderTools()->DrawUIRect(&Game, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(&Game, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
|
|
||||||
|
@ -901,6 +902,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
|
||||||
|
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
MainView.HSplitBottom(80.0f, &MainView, 0); // now we have the total rect for the settings
|
MainView.HSplitBottom(80.0f, &MainView, 0); // now we have the total rect for the settings
|
||||||
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
MainView.HSplitTop(BackgroundHeight, &TopView, &MainView);
|
MainView.HSplitTop(BackgroundHeight, &TopView, &MainView);
|
||||||
RenderTools()->DrawUIRect(&TopView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(&TopView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
|
|
||||||
|
@ -989,7 +991,6 @@ void CMenus::RenderSettingsTeeCustom(CUIRect MainView)
|
||||||
float BoxSize = 297.0f;
|
float BoxSize = 297.0f;
|
||||||
float BackgroundHeight = (ButtonHeight+SpacingH)*3.0f+BoxSize;
|
float BackgroundHeight = (ButtonHeight+SpacingH)*3.0f+BoxSize;
|
||||||
|
|
||||||
MainView.HSplitTop(BackgroundHeight, &MainView, 0);
|
|
||||||
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
|
|
||||||
MainView.HSplitTop(ButtonHeight, &Label, &MainView);
|
MainView.HSplitTop(ButtonHeight, &Label, &MainView);
|
||||||
|
@ -1046,6 +1047,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
||||||
BackgroundHeight = (ButtonHeight+SpacingH)*2.0f+SkinHeight;
|
BackgroundHeight = (ButtonHeight+SpacingH)*2.0f+SkinHeight;
|
||||||
|
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f);
|
||||||
MainView.HSplitTop(BackgroundHeight, &Preview, &MainView);
|
MainView.HSplitTop(BackgroundHeight, &Preview, &MainView);
|
||||||
RenderTools()->DrawUIRect(&Preview, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(&Preview, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
|
|
||||||
|
@ -1184,6 +1186,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
||||||
CUIRect BottomView, Button;
|
CUIRect BottomView, Button;
|
||||||
MainView.HSplitBottom(80.0f, &MainView, &BottomView);
|
MainView.HSplitBottom(80.0f, &MainView, &BottomView);
|
||||||
BottomView.HSplitTop(20.f, 0, &BottomView);
|
BottomView.HSplitTop(20.f, 0, &BottomView);
|
||||||
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f);
|
||||||
|
|
||||||
// split scrollbar from main view
|
// split scrollbar from main view
|
||||||
CUIRect Scroll;
|
CUIRect Scroll;
|
||||||
|
@ -1346,6 +1349,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
||||||
float BackgroundHeight = (float)(NumOptions+1)*ButtonHeight+(float)NumOptions*Spacing;
|
float BackgroundHeight = (float)(NumOptions+1)*ButtonHeight+(float)NumOptions*Spacing;
|
||||||
|
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f);
|
||||||
MainView.HSplitTop(BackgroundHeight, &ScreenLeft, &MainView);
|
MainView.HSplitTop(BackgroundHeight, &ScreenLeft, &MainView);
|
||||||
RenderTools()->DrawUIRect(&ScreenLeft, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(&ScreenLeft, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
|
|
||||||
|
@ -1589,8 +1593,13 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
|
||||||
float ButtonHeight = 20.0f;
|
float ButtonHeight = 20.0f;
|
||||||
float Spacing = 2.0f;
|
float Spacing = 2.0f;
|
||||||
float BackgroundHeight = (float)(NumOptions+1)*ButtonHeight+(float)NumOptions*Spacing;
|
float BackgroundHeight = (float)(NumOptions+1)*ButtonHeight+(float)NumOptions*Spacing;
|
||||||
|
float TotalHeight = BackgroundHeight;
|
||||||
|
if(g_Config.m_SndEnable)
|
||||||
|
TotalHeight += 10.0f+2.0f*ButtonHeight+Spacing;
|
||||||
|
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
|
MainView.HSplitTop(TotalHeight, &MainView, &BottomView);
|
||||||
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f);
|
||||||
MainView.HSplitTop(BackgroundHeight, &Sound, &MainView);
|
MainView.HSplitTop(BackgroundHeight, &Sound, &MainView);
|
||||||
RenderTools()->DrawUIRect(&Sound, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(&Sound, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
|
|
||||||
|
@ -1713,7 +1722,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset button
|
// reset button
|
||||||
MainView.HSplitBottom(60.0f, 0, &BottomView);
|
BottomView.HSplitBottom(60.0f, 0, &BottomView);
|
||||||
|
|
||||||
Spacing = 3.0f;
|
Spacing = 3.0f;
|
||||||
float ButtonWidth = (BottomView.w/6.0f)-(Spacing*5.0)/6.0f;
|
float ButtonWidth = (BottomView.w/6.0f)-(Spacing*5.0)/6.0f;
|
||||||
|
|
Loading…
Reference in a new issue