Grid updates

This commit is contained in:
Anuken
2018-05-19 15:01:18 -07:00
parent e8305d1245
commit e5a94bd140

View File

@ -21,11 +21,16 @@ public class GridImage extends Element{
float yspace = (getHeight() / imageHeight); float yspace = (getHeight() / imageHeight);
float s = 1f; float s = 1f;
for(int x = 0; x <= imageWidth; x ++){ 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 += jumpx){
batch.draw(blank, (int)(getX() + xspace * x - s), getY() - s, 2, getHeight()+ (x == imageWidth ? 1: 0)); 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); batch.draw(blank, getX() - s, (int)(getY() + y * yspace - s), getWidth(), 2);
} }
} }