From 94fb7d4c00c3fed1eaaaf0b044cc940cb4b7f4eb Mon Sep 17 00:00:00 2001 From: JusicP Date: Sun, 9 Jan 2022 20:21:50 +0200 Subject: [PATCH] Add xpos scale for chapters panel --- gameui/NewGameDialog.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/gameui/NewGameDialog.cpp b/gameui/NewGameDialog.cpp index 1c341752..36325e3c 100644 --- a/gameui/NewGameDialog.cpp +++ b/gameui/NewGameDialog.cpp @@ -525,11 +525,23 @@ CNewGameDialog::CNewGameDialog(vgui::Panel *parent, bool bCommentaryMode) : Base return; } + int indent = 8; + if ( IsProportional() ) + { + indent = scheme()->GetProportionalScaledValueEx( GetScheme(), indent ); + } + + int wide = 16; + if ( IsProportional() ) + { + wide = scheme()->GetProportionalScaledValueEx( GetScheme(), wide ); + } + // Layout panel positions relative to the dialog center. - int panelWidth = m_ChapterPanels[0]->GetWide() + 16; + int panelWidth = m_ChapterPanels[0]->GetWide() + wide; int dialogWidth = GetWide(); - m_PanelXPos[2] = ( dialogWidth - panelWidth ) / 2 + 8; + m_PanelXPos[2] = ( dialogWidth - panelWidth ) / 2 + indent; if (m_ChapterPanels.Count() > 1) { @@ -553,8 +565,8 @@ CNewGameDialog::CNewGameDialog(vgui::Panel *parent, bool bCommentaryMode) : Base int panelHeight; m_ChapterPanels[0]->GetSize( panelWidth, panelHeight ); - m_pCenterBg->SetWide( panelWidth + 16 ); - m_pCenterBg->SetPos( m_PanelXPos[2] - 8, m_PanelYPos[2] - (m_pCenterBg->GetTall() - panelHeight) + 8 ); + m_pCenterBg->SetWide( panelWidth + wide); + m_pCenterBg->SetPos( m_PanelXPos[2] - indent, m_PanelYPos[2] - (m_pCenterBg->GetTall() - panelHeight) + indent ); m_pCenterBg->SetBgColor( Color( 190, 115, 0, 255 ) ); // start the first item selected @@ -615,9 +627,9 @@ void CNewGameDialog::ApplySettings( KeyValues *inResourceData ) BaseClass::ApplySettings( inResourceData ); int ypos = inResourceData->GetInt( "chapterypos", 40 ); - if (IsProportional()) + if ( IsProportional() ) { - ypos = scheme()->GetProportionalScaledValueEx(GetScheme(), ypos); + ypos = scheme()->GetProportionalScaledValueEx( GetScheme(), ypos ); } for ( int i = 0; i < NUM_SLOTS; ++i )