From 74a7dc5eb9c772dd4d7b8405d615770882698207 Mon Sep 17 00:00:00 2001 From: DeltaNedas <39013340+DeltaNedas@users.noreply.github.com> Date: Wed, 16 Dec 2020 21:41:08 +0000 Subject: [PATCH] allow mods to set zoom limits (#4006) * allow mods to set zoom limits * rounding * dont round min * zoom 1.5 -> 1 --- core/src/mindustry/core/Renderer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index ea9e22a3ce..4b05e83a68 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -30,6 +30,8 @@ public class Renderer implements ApplicationListener{ public @Nullable Bloom bloom; public FrameBuffer effectBuffer = new FrameBuffer(); public float laserOpacity = 1f; + /** minZoom = zooming out, maxZoom = zooming in */ + public float minZoom = 1.5f, maxZoom = 6f; //TODO unused private FxProcessor fx = new FxProcessor(); @@ -302,8 +304,7 @@ public class Renderer implements ApplicationListener{ } public void clampScale(){ - float s = Scl.scl(1f); - targetscale = Mathf.clamp(targetscale, minScale(), Math.round(s * 6)); + targetscale = Mathf.clamp(targetscale, minScale(), maxScale()); } public float getDisplayScale(){ @@ -311,7 +312,11 @@ public class Renderer implements ApplicationListener{ } public float minScale(){ - return Scl.scl(1.5f); + return Scl.scl(minZoom); + } + + public float maxScale(){ + return Mathf.round(Scl.scl(maxZoom)); } public float getScale(){