mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Restore proportional minimap scaling (#15022)
This commit is contained in:
parent
52376fd87a
commit
322a9c2f74
4 changed files with 25 additions and 7 deletions
|
@ -568,14 +568,21 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
|
|||
}
|
||||
break; }
|
||||
case HUD_ELEM_MINIMAP: {
|
||||
if (e->size.X <= 0 || e->size.Y <= 0)
|
||||
break;
|
||||
if (!client->getMinimap())
|
||||
break;
|
||||
// Draw a minimap of size "size"
|
||||
v2s32 dstsize(e->size.X * m_scale_factor,
|
||||
e->size.Y * m_scale_factor);
|
||||
// (no percent size as minimap would likely be anamorphosed)
|
||||
|
||||
// Only one percentage is supported to avoid distortion.
|
||||
if (e->size.X < 0)
|
||||
dstsize.X = dstsize.Y = m_screensize.X * (e->size.X * -0.01);
|
||||
else if (e->size.Y < 0)
|
||||
dstsize.X = dstsize.Y = m_screensize.Y * (e->size.Y * -0.01);
|
||||
|
||||
if (dstsize.X <= 0 || dstsize.Y <= 0)
|
||||
return;
|
||||
|
||||
v2s32 offset((e->align.X - 1.0) * dstsize.X / 2,
|
||||
(e->align.Y - 1.0) * dstsize.Y / 2);
|
||||
core::rect<s32> rect(0, 0, dstsize.X, dstsize.Y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue