From e5a94bd140c7e859ae9a3411cd7307fb910e2fe9 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 19 May 2018 15:01:18 -0700 Subject: [PATCH] Grid updates --- core/src/io/anuke/mindustry/ui/GridImage.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/io/anuke/mindustry/ui/GridImage.java b/core/src/io/anuke/mindustry/ui/GridImage.java index b7c5ce6700..13d2c175b0 100644 --- a/core/src/io/anuke/mindustry/ui/GridImage.java +++ b/core/src/io/anuke/mindustry/ui/GridImage.java @@ -20,12 +20,17 @@ public class GridImage extends Element{ float xspace = (getWidth() / imageWidth); float yspace = (getHeight() / imageHeight); float s = 1f; + + int minspace = 10; + + int jumpx = (int)(Math.max(minspace, xspace) / xspace); + int jumpy = (int)(Math.max(minspace, yspace)/ yspace); - for(int x = 0; x <= imageWidth; x ++){ + for(int x = 0; x <= imageWidth; x += jumpx){ batch.draw(blank, (int)(getX() + xspace * x - s), getY() - s, 2, getHeight()+ (x == imageWidth ? 1: 0)); } - for(int y = 0; y <= imageHeight; y ++){ + for(int y = 0; y <= imageHeight; y += jumpy){ batch.draw(blank, getX() - s, (int)(getY() + y * yspace - s), getWidth(), 2); } }