it is done

This commit is contained in:
Anuken
2019-12-25 01:39:38 -05:00
parent 5b21873f3c
commit 514d4817c8
488 changed files with 4572 additions and 4574 deletions

View File

@@ -0,0 +1,38 @@
package mindustry.ui;
import arc.graphics.g2d.Fill;
import arc.scene.Element;
public class GridImage extends Element{
private int imageWidth, imageHeight;
public GridImage(int w, int h){
this.imageWidth = w;
this.imageHeight = h;
}
@Override
public void draw(){
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 += jumpx){
Fill.crect((int)(getX() + xspace * x - s), getY() - s, 2, getHeight() + (x == imageWidth ? 1 : 0));
}
for(int y = 0; y <= imageHeight; y += jumpy){
Fill.crect(getX() - s, (int)(getY() + y * yspace - s), getWidth(), 2);
}
}
public void setImageSize(int w, int h){
this.imageWidth = w;
this.imageHeight = h;
}
}