GameUI: fix propotional scale

This commit is contained in:
nillerusr
2022-04-16 12:20:36 +03:00
parent 23a370d9bb
commit 0772ca1063
12 changed files with 57 additions and 36 deletions
+8 -4
View File
@@ -242,8 +242,12 @@ public:
{
BaseClass::ApplySchemeSettings(pScheme);
int height = atoi(pScheme->GetResourceString("MainMenu.MenuItemHeight"));
if( IsProportional() )
height = scheme()->GetProportionalScaledValue( height );
// make fully transparent
SetMenuItemHeight(atoi(pScheme->GetResourceString("MainMenu.MenuItemHeight")));
SetMenuItemHeight(height);
SetBgColor(Color(0, 0, 0, 0));
SetBorder(NULL);
}
@@ -292,7 +296,6 @@ public:
MenuItem *item = new CGameMenuItem(this, itemName);
item->AddActionSignalTarget(target);
item->SetCommand(command);
item->SetProportional(true);
item->SetText(itemText);
item->SetUserData(userData);
return BaseClass::AddMenuItem(item);
@@ -303,7 +306,6 @@ public:
MenuItem *item = new CGameMenuItem(this, itemName);
item->AddActionSignalTarget(target);
item->SetCommand(command);
item->SetProportional(true);
item->SetText(itemText);
item->SetUserData(userData);
return BaseClass::AddMenuItem(item);
@@ -659,7 +661,6 @@ void CGameMenu::OnCursorEnteredMenuItem(int VPanel)
static CBackgroundMenuButton* CreateMenuButton( CBasePanel *parent, const char *panelName, const wchar_t *panelText )
{
CBackgroundMenuButton *pButton = new CBackgroundMenuButton( parent, panelName );
pButton->SetProportional(true);
pButton->SetCommand("OpenGameMenu");
pButton->SetText(panelText);
@@ -673,6 +674,9 @@ bool g_bIsCreatingNewGameMenuForPreFetching = false;
//-----------------------------------------------------------------------------
CBasePanel::CBasePanel() : Panel(NULL, "BaseGameUIPanel")
{
if( NeedProportional() )
SetProportional( true );
g_pBasePanel = this;
m_bLevelLoading = false;
m_eBackgroundState = BACKGROUND_INITIAL;
+2
View File
@@ -12,6 +12,7 @@
#include "vgui/KeyCode.h"
#include "LoadingDialog.h"
#include "IGameUIFuncs.h"
#include "tier0/icommandline.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -24,6 +25,7 @@ using namespace vgui;
//-----------------------------------------------------------------------------
CGameConsoleDialog::CGameConsoleDialog() : BaseClass( NULL, "GameConsole", false )
{
if( NeedProportional() ) SetProportional(true);
AddActionSignalTarget( this );
}
+4 -4
View File
@@ -203,6 +203,8 @@ void CGameUI::Initialize( CreateInterfaceFn factory )
Error( "CGameUI::Initialize() failed to get necessary interfaces\n" );
}
vgui::VPANEL rootpanel = enginevguifuncs->GetPanel( PANEL_GAMEUIDLL );
// setup base panel
staticPanel = new CBasePanel();
staticPanel->SetBounds(0, 0, 400, 300 );
@@ -212,9 +214,7 @@ void CGameUI::Initialize( CreateInterfaceFn factory )
staticPanel->SetVisible( true );
staticPanel->SetMouseInputEnabled( false );
staticPanel->SetKeyBoardInputEnabled( false );
vgui::VPANEL rootpanel = enginevguifuncs->GetPanel( PANEL_GAMEUIDLL );
staticPanel->SetParent( rootpanel );
staticPanel->SetParent(rootpanel);
}
void CGameUI::PostInit()
@@ -1282,4 +1282,4 @@ void CGameUI::SendMainMenuCommand( const char *pszCommand )
{
pBasePanel->RunMenuCommand( pszCommand );
}
}
}
-4
View File
@@ -362,10 +362,6 @@ void COptionsSubAudio::OnCommand( const char *command )
RunTestSpeakers();
}
}
else if ( !stricmp( command, "ShowThirdPartyAudioCredits" ) )
{
OpenThirdPartySoundCreditsDialog();
}
BaseClass::OnCommand( command );
}
+9 -1
View File
@@ -30,6 +30,7 @@
#include <vstdlib/IKeyValuesSystem.h>
#include "tier2/tier2.h"
#include "inputsystem/iinputsystem.h"
#include "tier0/icommandline.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -760,8 +761,15 @@ public:
{
// parent is ignored, since we want look like we're steal focus from the parent (we'll become modal below)
if( NeedProportional() )
SetProportional(true);
SetTitle("#GameUI_KeyboardAdvanced_Title", true);
SetSize( 280, 140 );
if( IsProportional() )
SetSize( scheme()->GetProportionalScaledValue( 280 ), scheme()->GetProportionalScaledValue( 140 ) );
else
SetSize( 280, 140 );
LoadControlSettings( "resource/OptionsSubKeyboardAdvancedDlg.res" );
MoveToCenterOfScreen();
SetSizeable( false );
+2 -1
View File
@@ -1030,7 +1030,8 @@ COptionsSubVideo::COptionsSubVideo(vgui::Panel *parent) : PropertyPage(parent, N
m_pBenchmark = new Button( this, "BenchmarkButton", "#GameUI_LaunchBenchmark" );
m_pBenchmark->SetCommand(new KeyValues("LaunchBenchmark"));
m_pThirdPartyCredits = new URLButton(this, "ThirdPartyVideoCredits", "#GameUI_ThirdPartyTechCredits");
m_pThirdPartyCredits->SetCommand(new KeyValues("OpenThirdPartyVideoCreditsDialog"));
// m_pThirdPartyCredits->SetCommand(new KeyValues("OpenThirdPartyVideoCreditsDialog"));
m_pThirdPartyCredits->SetVisible(false);
m_pHDContent = new CheckButton( this, "HDContentButton", "#GameUI_HDContent" );
char pszAspectName[3][64];
+9 -2
View File
@@ -366,7 +366,12 @@ void CAchievementsDialog_XBox::OnClose()
CAchievementsDialog::CAchievementsDialog(vgui::Panel *parent) : BaseClass(parent, "AchievementsDialog")
{
SetDeleteSelfOnClose(true);
SetBounds(0, 0, 512, 384);
if( IsProportional() )
SetBounds(0, 0, scheme()->GetProportionalScaledValue(512), scheme()->GetProportionalScaledValue(384));
else
SetBounds(0, 0, 512, 384);
SetMinimumSize( 256, 300 );
SetSizeable( true );
@@ -506,7 +511,8 @@ void CAchievementsDialog::CreateNewAchievementGroup( int iMinRange, int iMaxRang
//----------------------------------------------------------
void CAchievementsDialog::ApplySettings( KeyValues *pResourceData )
{
m_iFixedWidth = pResourceData->GetInt( "wide", 512 );
int width = pResourceData->GetInt( "wide", 512 );
m_iFixedWidth = IsProportional() ? scheme()->GetProportionalScaledValue(width) : width;
BaseClass::ApplySettings( pResourceData );
}
@@ -1073,3 +1079,4 @@ void CAchievementDialogItemPanel::OnCheckButtonChecked(Panel *panel)
m_pSourceAchievement->SetShowOnHUD( m_pShowOnHUDCheck->IsSelected() );
}
}