gui and text drawing, gui misc

This commit is contained in:
Sen 2025-03-19 21:54:09 +01:00
parent c906760bd4
commit 4ec8affe85
37 changed files with 799 additions and 646 deletions

View file

@ -1,5 +1,8 @@
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;
@ -36,11 +39,19 @@ public class Fill extends Element {
return false;
}
protected boolean isTextCenteredX() {
return !this.left;
}
// protected boolean isTextCenteredX() {
// return !this.left;
// }
//
// protected boolean isTextCenteredY() {
// return !this.top;
// }
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;
}
}