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

@ -120,16 +120,15 @@ public abstract class GuiContainer extends Gui
public void drawString(String text, int x, int y) {
x = x * 2 + this.container_x;
y = y * 2 + this.container_y;
Drawing.txt_draw(x, y, x, y, x + 440, y + 260, 0xffffffff, text);
Drawing.drawText(text, x, y, 0xffffffff);
}
public int getStringWidth(String text) {
Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, text);
return size.xpos / 2;
return Drawing.getSize(text).xpos / 2;
}
public void rect(int x, int y, int width, int height, int color) {
Drawing.drawRectColor(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | color);
Drawing.drawRect(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | color);
}
public InventoryButton button(int x, int y, int w, int h) {
@ -1087,12 +1086,12 @@ public abstract class GuiContainer extends Gui
s = TextColor.RED + ItemStack.formatAmount(stack.stackSize);
}
// this.drawString(s, , );
Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, s);
int x = xPosition + 34 - size.xpos; // this.getStringWidth(s);
int y = yPosition + 17;
// Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, s);
// int x = - size.xpos; // this.getStringWidth(s);
// int y = ;
// x = x * 2 + this.container_x;
// y = y * 2 + this.container_y;
Drawing.txt_draw(x, y, x, y, x + 440, y + 260, 0xffffffff, s);
Drawing.drawTextRight(s, xPosition + 32, yPosition + 17, 0xffffffff);
}
if (stack.isItemDamaged())
@ -1109,7 +1108,7 @@ public abstract class GuiContainer extends Gui
private static void draw(int x, int y, int width, int height, int red, int green, int blue)
{
// Drawing.gfx_draw_rect_color(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | (red << 16) | (green << 8) | blue);
Drawing.drawRectColor(x, y, width, height, 0xff000000 | (red << 16) | (green << 8) | blue);
Drawing.drawRect(x, y, width, height, 0xff000000 | (red << 16) | (green << 8) | blue);
}
public void drawBackground() {