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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user