Files
Mindustry/core/src/mindustry/ui/BorderImage.java
2023-08-02 22:15:44 -04:00

52 lines
1.1 KiB
Java

package mindustry.ui;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import mindustry.graphics.*;
public class BorderImage extends Image{
public float thickness = 4f, pad = 0f;
public Color borderColor = Pal.gray;
public BorderImage(){
}
public BorderImage(Texture texture){
super(texture);
}
public BorderImage(Texture texture, float thick){
super(texture);
thickness = thick;
}
public BorderImage(TextureRegion region, float thick){
super(region);
thickness = thick;
}
public BorderImage(Drawable region){
super(region);
}
public BorderImage border(Color color){
this.borderColor = color;
return this;
}
@Override
public void draw(){
super.draw();
Draw.color(borderColor);
Draw.alpha(parentAlpha);
Lines.stroke(Scl.scl(thickness));
Lines.rect(x + imageX - pad, y + imageY - pad, imageWidth * scaleX + pad*2, imageHeight * scaleY + pad*2);
Draw.reset();
}
}