diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 86c290d71..35ff02a11 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -200,14 +200,35 @@ void CMenus::RenderPlayers(CUIRect MainView) CUIRect Label, Row; MainView.HSplitBottom(80.0f, &MainView, 0); MainView.HSplitTop(20.0f, 0, &MainView); - RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f+ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f); // player options MainView.HSplitTop(ButtonHeight, &Label, &MainView); Label.y += 2.0f; UI()->DoLabel(&Label, Localize("Player options"), ButtonHeight*ms_FontmodHeight*0.8f, CUI::ALIGN_CENTER); RenderTools()->DrawUIRect(&MainView, vec4(0.0, 0.0, 0.0, 0.25f), CUI::CORNER_ALL, 5.0f); - MainView.Margin(5.0f, &MainView); + + // scroll + CUIRect Scroll; + int NumClients = 0; + for(int i = 0; i < MAX_CLIENTS; ++i) + if(i != m_pClient->m_LocalClientID && m_pClient->m_aClients[i].m_Active) + NumClients++; + float Length = ButtonHeight * NumClients; + static float s_ScrollValue = 0.0f; + int ScrollNum = (int)((Length - MainView.h)/20.0f)+1; + if(ScrollNum > 0) + { + if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&MainView)) + s_ScrollValue = clamp(s_ScrollValue - 3.0f/ScrollNum, 0.0f, 1.0f); + if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&MainView)) + s_ScrollValue = clamp(s_ScrollValue + 3.0f / ScrollNum, 0.0f, 1.0f); + } + MainView.VSplitRight(20.0f, &MainView, &Scroll); + Scroll.HSplitTop(ButtonHeight, 0, &Scroll); + RenderTools()->DrawUIRect(&Scroll, vec4(0.0, 0.0, 0.0, 0.25f), CUI::CORNER_ALL, 5.0f); + Scroll.HMargin(5.0f, &Scroll); + s_ScrollValue = DoScrollbarV(&s_ScrollValue, &Scroll, s_ScrollValue); // headline MainView.HSplitTop(ButtonHeight, &Row, &MainView); @@ -233,31 +254,13 @@ void CMenus::RenderPlayers(CUIRect MainView) Graphics()->QuadsDrawTL(&QuadItem, 1); Graphics()->QuadsEnd(); - // scroll - CUIRect Scroll; - int NumClients = 0; - for(int i = 0; i < MAX_CLIENTS; ++i) - if(i != m_pClient->m_LocalClientID && m_pClient->m_aClients[i].m_Active) - NumClients++; - float Length = ButtonHeight * NumClients; - static float s_ScrollValue = 0.0f; - int ScrollNum = (int)((Length - MainView.h)/20.0f)+1; - if(ScrollNum > 0) - { - if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&MainView)) - s_ScrollValue = clamp(s_ScrollValue - 3.0f/ScrollNum, 0.0f, 1.0f); - if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&MainView)) - s_ScrollValue = clamp(s_ScrollValue + 3.0f / ScrollNum, 0.0f, 1.0f); - } + // background + RenderTools()->DrawUIRect(&MainView, vec4(0.0, 0.0, 0.0, 0.25f), CUI::CORNER_ALL, 5.0f); + MainView.Margin(5.0f, &MainView); UI()->ClipEnable(&MainView); if(Length > MainView.h) - { - MainView.VSplitRight(8.0f, &MainView, &Scroll); - Scroll.HMargin(5.0f, &Scroll); - s_ScrollValue = DoScrollbarV(&s_ScrollValue, &Scroll, s_ScrollValue); MainView.y += (MainView.h - Length) * s_ScrollValue; - } // options static int s_aPlayerIDs[MAX_CLIENTS][2] = {{0}};