mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 01:39:36 +00:00
Add proportionality support for GameUI panels (#35)
* Add proportionality support for GameUI panels * Add Android platform define * Fix button wrong state on fast clicking Co-authored-by: JusicP <slender87844@gmail.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user