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

@@ -90,6 +90,21 @@ void ImagePanel::SetImage(const char *imageName)
m_pszImageName = new char[ len ];
Q_strncpy(m_pszImageName, imageName, len );
InvalidateLayout(false, true); // force applyschemesettings to run
if (IsProportional() && m_pImage && !m_bScaleImage)
{
float scale = 1;
int screenW, screenH;
surface()->GetScreenSize(screenW, screenH);
int proW, proH;
surface()->GetProportionalBase(proW, proH);
scale = ((float)(screenH) / (float)(proH));
m_fScaleAmount = scale;
m_bScaleImage = true;
}
}
//-----------------------------------------------------------------------------