From fab3c08ddb977d49727bc35716108d806a89a3a1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 20 Jul 2025 20:05:32 -0400 Subject: [PATCH] Mobile improvements --- core/src/mindustry/editor/MapEditorDialog.java | 4 +++- core/src/mindustry/editor/MapRenderer.java | 13 +++++++++---- core/src/mindustry/editor/MapView.java | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/editor/MapEditorDialog.java b/core/src/mindustry/editor/MapEditorDialog.java index 47e1a979c8..5e617806f4 100644 --- a/core/src/mindustry/editor/MapEditorDialog.java +++ b/core/src/mindustry/editor/MapEditorDialog.java @@ -834,7 +834,9 @@ public class MapEditorDialog extends Dialog implements Disposable{ if(i == 0) editor.drawBlock = block; - if(++i % 6 == 0){ + int cols = mobile ? 4 : 6; + + if(++i % cols == 0){ blockSelection.row(); } } diff --git a/core/src/mindustry/editor/MapRenderer.java b/core/src/mindustry/editor/MapRenderer.java index a4b32967ab..311e4c8876 100644 --- a/core/src/mindustry/editor/MapRenderer.java +++ b/core/src/mindustry/editor/MapRenderer.java @@ -67,7 +67,10 @@ public class MapRenderer implements Disposable{ Draw.flush(); - renderer.blocks.floor.checkChanges(); + //don't process terrain updates every frame (helps with lag on low end devices) + boolean doUpdate = Core.graphics.getFrameId() % 2 == 0; + + if(doUpdate) renderer.blocks.floor.checkChanges(); boolean prev = renderer.animateWater; renderer.animateWater = false; @@ -84,7 +87,7 @@ public class MapRenderer implements Disposable{ //scissors are always enabled because this is drawn clipped in UI, make sure they don't interfere with drawing shadow events Gl.disable(Gl.scissorTest); - renderer.blocks.processShadows(); + if(doUpdate) renderer.blocks.processShadows(); Gl.enable(Gl.scissorTest); @@ -102,8 +105,10 @@ public class MapRenderer implements Disposable{ if(chunks == null) return; - recacheChunks.each(i -> recacheChunk(Point2.x(i), Point2.y(i))); - recacheChunks.clear(); + if(doUpdate){ + recacheChunks.each(i -> recacheChunk(Point2.x(i), Point2.y(i))); + recacheChunks.clear(); + } shader.bind(); shader.setUniformMatrix4("u_projTrans", Core.camera.mat); diff --git a/core/src/mindustry/editor/MapView.java b/core/src/mindustry/editor/MapView.java index 55c40faee4..e030350238 100644 --- a/core/src/mindustry/editor/MapView.java +++ b/core/src/mindustry/editor/MapView.java @@ -11,6 +11,7 @@ import arc.scene.*; import arc.scene.event.*; import arc.scene.ui.layout.*; import arc.util.*; +import mindustry.*; import mindustry.graphics.*; import mindustry.input.*; import mindustry.ui.*; @@ -18,7 +19,7 @@ import mindustry.ui.*; import static mindustry.Vars.*; public class MapView extends Element implements GestureListener{ - EditorTool tool = EditorTool.pencil; + EditorTool tool = Vars.mobile ? EditorTool.zoom : EditorTool.pencil; private float offsetx, offsety; private float zoom = 1f; private boolean grid = false;