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:
nillerusr
2022-01-09 17:04:47 +03:00
committed by GitHub
co-authored by JusicP
parent 1f3436945f
commit 9d77bb17c5
20 changed files with 296 additions and 150 deletions
+15
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;
}
}
//-----------------------------------------------------------------------------