57 lines
1.2 KiB
Java
57 lines
1.2 KiB
Java
package game.gui.element;
|
|
|
|
import game.renderer.Drawing;
|
|
import game.renderer.Drawing.Vec2i;
|
|
|
|
public class Fill extends Element {
|
|
private final boolean left;
|
|
private final boolean top;
|
|
|
|
public Fill(int x, int y, int w, int h, String text, boolean top, boolean left) {
|
|
super(x, y, w, h, null);
|
|
this.top = top;
|
|
this.left = left;
|
|
this.setText(text);
|
|
}
|
|
|
|
public Fill(int x, int y, int w, int h, String text, boolean left) {
|
|
this(x, y, w, h, text, false, left);
|
|
}
|
|
|
|
public Fill(int x, int y, int w, int h, String text) {
|
|
this(x, y, w, h, text, false, false);
|
|
}
|
|
|
|
public Fill(int x, int y, int w, int h, boolean top, boolean left) {
|
|
this(x, y, w, h, "", top, left);
|
|
}
|
|
|
|
public Fill(int x, int y, int w, int h, boolean left) {
|
|
this(x, y, w, h, "", false, left);
|
|
}
|
|
|
|
public Fill(int x, int y, int w, int h) {
|
|
this(x, y, w, h, "", false, false);
|
|
}
|
|
|
|
|
|
public boolean canHover() {
|
|
return false;
|
|
}
|
|
|
|
// protected boolean isTextCenteredX() {
|
|
// return !this.left;
|
|
// }
|
|
//
|
|
// protected boolean isTextCenteredY() {
|
|
// return !this.top;
|
|
// }
|
|
|
|
public void updateText() {
|
|
Vec2i size = Drawing.getSize(this.text);
|
|
if(!this.left)
|
|
this.text_x = (this.size_x - size.xpos) / 2;
|
|
if(!this.top)
|
|
this.text_y = (this.size_y - size.ypos) / 2;
|
|
}
|
|
}
|