Add proportionality support for GameUI panels

This commit is contained in:
JusicP
2021-10-31 21:45:57 +02:00
parent 7a69af7b00
commit 82545dfe26
18 changed files with 280 additions and 143 deletions

View File

@@ -844,12 +844,24 @@ void CConsolePanel::PerformLayout()
if ( !m_bStatusVersion )
{
const int inset = 8;
const int entryHeight = 24;
const int topHeight = 4;
const int entryInset = 4;
const int submitWide = 64;
const int submitInset = 7; // x inset to pull the submit button away from the frame grab
float scale = 1;
if (IsProportional())
{
int screenW, screenH;
surface()->GetScreenSize(screenW, screenH);
int proW, proH;
surface()->GetProportionalBase(proW, proH);
scale = ((float)(screenH) / (float)(proH));
}
const int inset = 8 * scale;
const int entryHeight = 24 * scale;
const int topHeight = 4 * scale;
const int entryInset = 4 * scale;
const int submitWide = 64 * scale;
const int submitInset = 7 * scale; // x inset to pull the submit button away from the frame grab
m_pHistory->SetPos(inset, inset + topHeight);
m_pHistory->SetSize(wide - (inset * 2), tall - (entryInset * 2 + inset * 2 + topHeight + entryHeight));
@@ -931,6 +943,7 @@ void CConsolePanel::ApplySchemeSettings(IScheme *pScheme)
m_DPrintColor = GetSchemeColor("Console.DevTextColor", pScheme);
m_pHistory->SetFont( pScheme->GetFont( "ConsoleText", IsProportional() ) );
m_pCompletionList->SetFont( pScheme->GetFont( "DefaultSmall", IsProportional() ) );
m_pEntry->SetFont( pScheme->GetFont( "DefaultSmall", IsProportional() ) );
InvalidateLayout();
}