Skip to content

Commit

Permalink
Fix a bug that VGUI2 controls are still scaled when it shouldn't be.
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Feb 5, 2024
1 parent 8970c32 commit 719ba34
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions Plugins/VGUI2Extension/GameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,22 @@ ServerBrowser inline hook

void __fastcall ServerBrowser_Panel_SetSize(vgui::Panel* pthis, int dummy, int width, int height)
{
width = g_pVGuiSchemeManager2->GetProportionalScaledValue(width);
height = g_pVGuiSchemeManager2->GetProportionalScaledValue(height);
if (pthis->IsProportional())
{
width = g_pVGuiSchemeManager2->GetProportionalScaledValue(width);
height = g_pVGuiSchemeManager2->GetProportionalScaledValue(height);
}

gPrivateFuncs.ServerBrowser_Panel_SetSize(pthis, 0, width, height);
}

void __fastcall ServerBrowser_Panel_SetMinimumSize(vgui::Panel* pthis, int dummy, int width, int height)
{
width = g_pVGuiSchemeManager2->GetProportionalScaledValue(width);
height = g_pVGuiSchemeManager2->GetProportionalScaledValue(height);
if (pthis->IsProportional())
{
width = g_pVGuiSchemeManager2->GetProportionalScaledValue(width);
height = g_pVGuiSchemeManager2->GetProportionalScaledValue(height);
}

gPrivateFuncs.ServerBrowser_Panel_SetMinimumSize(pthis, 0, width, height);
}
Expand Down Expand Up @@ -540,13 +546,18 @@ void __fastcall GameUI_Panel_Init(vgui::Panel* pthis, int dummy, int x, int y, i

void __fastcall GameUI_MessageBox_ApplySchemeSettings_Panel_SetSize(vgui::Panel* pthis, int dummy, int width, int height)
{
int basewidth = width - 100;
int baseheight = height - 100;
if (pthis->IsProportional())
{
int basewidth = width - 100;
int baseheight = height - 100;

width = basewidth + g_pVGuiSchemeManager2->GetProportionalScaledValue(100);
height = baseheight + g_pVGuiSchemeManager2->GetProportionalScaledValue(100);

width = basewidth + g_pVGuiSchemeManager2->GetProportionalScaledValue(100);
height = baseheight + g_pVGuiSchemeManager2->GetProportionalScaledValue(100);
return gPrivateFuncs.GameUI_Panel_SetSize(pthis, 0, width, height);
}

gPrivateFuncs.GameUI_Panel_SetSize(pthis, 0, width, height);
return gPrivateFuncs.GameUI_Panel_SetSize(pthis, 0, width, height);
}

/*
Expand Down

0 comments on commit 719ba34

Please sign in to comment.