Add xpos scale for chapters panel

This commit is contained in:
JusicP 2022-01-09 20:21:50 +02:00
parent 463e4eb584
commit 94fb7d4c00

View File

@ -525,11 +525,23 @@ CNewGameDialog::CNewGameDialog(vgui::Panel *parent, bool bCommentaryMode) : Base
return; 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. // 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(); int dialogWidth = GetWide();
m_PanelXPos[2] = ( dialogWidth - panelWidth ) / 2 + 8; m_PanelXPos[2] = ( dialogWidth - panelWidth ) / 2 + indent;
if (m_ChapterPanels.Count() > 1) if (m_ChapterPanels.Count() > 1)
{ {
@ -553,8 +565,8 @@ CNewGameDialog::CNewGameDialog(vgui::Panel *parent, bool bCommentaryMode) : Base
int panelHeight; int panelHeight;
m_ChapterPanels[0]->GetSize( panelWidth, panelHeight ); m_ChapterPanels[0]->GetSize( panelWidth, panelHeight );
m_pCenterBg->SetWide( panelWidth + 16 ); m_pCenterBg->SetWide( panelWidth + wide);
m_pCenterBg->SetPos( m_PanelXPos[2] - 8, m_PanelYPos[2] - (m_pCenterBg->GetTall() - panelHeight) + 8 ); m_pCenterBg->SetPos( m_PanelXPos[2] - indent, m_PanelYPos[2] - (m_pCenterBg->GetTall() - panelHeight) + indent );
m_pCenterBg->SetBgColor( Color( 190, 115, 0, 255 ) ); m_pCenterBg->SetBgColor( Color( 190, 115, 0, 255 ) );
// start the first item selected // start the first item selected
@ -615,9 +627,9 @@ void CNewGameDialog::ApplySettings( KeyValues *inResourceData )
BaseClass::ApplySettings( inResourceData ); BaseClass::ApplySettings( inResourceData );
int ypos = inResourceData->GetInt( "chapterypos", 40 ); 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 ) for ( int i = 0; i < NUM_SLOTS; ++i )