mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-10 15:57:37 +07:00
Grid updates
This commit is contained in:
@ -20,12 +20,17 @@ public class GridImage extends Element{
|
|||||||
float xspace = (getWidth() / imageWidth);
|
float xspace = (getWidth() / imageWidth);
|
||||||
float yspace = (getHeight() / imageHeight);
|
float yspace = (getHeight() / imageHeight);
|
||||||
float s = 1f;
|
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));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user