mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 13:47:58 +03:00
Return a virtual scale with the correct ratio if scale variable is set
This prevents the widget from being stretched out on widescreen, currently only the compass uses scalecvar
This commit is contained in:
parent
05d304dfc3
commit
59d03ff6f0
1 changed files with 11 additions and 5 deletions
|
@ -3141,14 +3141,20 @@ void UIWidget::SetScaleCvar
|
|||
|
||||
void UIWidget::SetVirtualScale(vec2_t out)
|
||||
{
|
||||
out[0] = uid.vidWidth / 640.0;
|
||||
out[1] = uid.vidHeight / 480.0;
|
||||
|
||||
if (m_scaleCvar)
|
||||
{
|
||||
out[0] *= m_scaleCvar->value;
|
||||
out[1] *= m_scaleCvar->value;
|
||||
const float vidRatio = (float)uid.vidWidth / (float)uid.vidHeight;
|
||||
const float minHeight = 480;
|
||||
const float minWidth = minHeight * vidRatio;
|
||||
|
||||
out[0] = uid.vidWidth / minWidth * m_scaleCvar->value;
|
||||
out[1] = uid.vidHeight / minHeight * m_scaleCvar->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
out[0] = uid.vidWidth / 640.0;
|
||||
out[1] = uid.vidHeight / 480.0;
|
||||
}
|
||||
}
|
||||
|
||||
void UIWidget::SetDontLocalize(Event* ev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue