loading gui + converter

This commit is contained in:
Sen 2025-03-16 21:58:40 +01:00
parent 9df6406a93
commit 90de256e04
7 changed files with 259 additions and 178 deletions

View file

@ -317,31 +317,9 @@ public abstract class Gui {
Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010);
}
else {
this.drawDirtBackground(0, 0, this.gm.fb_x, this.gm.fb_y);
Drawing.drawScaledBackground(this.gm, DIRT_BACKGROUND);
}
}
public void drawDirtBackground(double x, double y, double width, double height) {
GlState.enableTexture2D();
GlState.disableLighting();
GlState.disableFog();
RenderBuffer buf = Tessellator.getBuffer();
this.gm.getTextureManager().bindTexture(DIRT_BACKGROUND);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
double scale = 32.0;
buf.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
buf.pos(x, y + height, 0.0D).tex(0.0D, height / scale)
.color(64, 64, 64, 255).endVertex();
buf.pos(x + width, y + height, 0.0D)
.tex(width / scale, height / scale)
.color(64, 64, 64, 255).endVertex();
buf.pos(x + width, y, 0.0D).tex(width / scale, 0.0)
.color(64, 64, 64, 255).endVertex();
buf.pos(x, y, 0.0D).tex(0.0D, 0.0)
.color(64, 64, 64, 255).endVertex();
Tessellator.draw();
GlState.disableTexture2D();
}
public void render() {
this.drawMainBackground();

View file

@ -75,7 +75,7 @@ public class GuiEdit extends Gui implements ActButton.Callback, Textbox.Callback
public void init(int width, int height) {
this.actionButton = this.add(new ActButton(width / 2 - 100, height / 4 + 96 + 12, 200, 20, (ActButton.Callback)this, this.action));
this.cancelButton = this.add(new ActButton(width / 2 - 100, height / 4 + 120 + 12, 200, 20, (ActButton.Callback)this, "Abbrechen"));
this.nameField = this.add(new Textbox(width / 2 - 100, 60, 200, 20, this.player ? NetHandlerPlayServer.MAX_USER_LENGTH : 256, true, this, this.player ? NetHandlerPlayServer.VALID_USER : GuiWorlds.VALID_FILE, this.original == null ? "" : this.original));
this.nameField = this.add(new Textbox(width / 2 - 200, 60, 400, 20, this.player ? NetHandlerPlayServer.MAX_USER_LENGTH : 256, true, this, this.player ? NetHandlerPlayServer.VALID_USER : GuiWorlds.VALID_FILE, this.original == null ? "" : this.original));
this.nameField.setSelected();
// if(this.player) {
// this.nameField.setMaxStringLength(16);
@ -96,7 +96,7 @@ public class GuiEdit extends Gui implements ActButton.Callback, Textbox.Callback
// }
// });
// }
this.actionLabel = this.add(new Label(width / 2 - 100, 20, 200, 24, this.getLabelDesc()));
this.actionLabel = this.add(new Label(width / 2 - 250, 20, 500, 24, this.getLabelDesc()));
// this.shift();
// this.nameField.setText();
this.actionButton.enabled = false;

View file

@ -12,6 +12,7 @@ import java.util.Set;
import com.google.common.collect.Sets;
import game.Game;
import game.color.TextColor;
import game.dimension.Dimension;
import game.gui.GuiConfirm;
@ -487,8 +488,8 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
}
else {
if(this.getSelected().mustConvert()) {
this.gm.convert(folder, user);
this.gm.displayGuiScreen(this);
Game r = this.gm;
Converter.convertMapFormat(folder, user);
this.starting = false;
}
else {
@ -607,9 +608,10 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
{
super.drawOverlays();
if(this.warningMessage != null) {
drawRect(this.gm.fb_x / 2 - 191, this.gm.fb_y - 82, this.gm.fb_x / 2 + 191, this.gm.fb_y - 66, 0xff808080);
drawRect(this.gm.fb_x / 2 - 190, this.gm.fb_y - 81, this.gm.fb_x / 2 + 190, this.gm.fb_y - 67, 0xff000000);
Drawing.drawText(this.warningMessage, this.gm.fb_x / 2, this.gm.fb_y - 78, 0xffff0000);
Drawing.drawRectBorder(this.gm.fb_x / 2 - 200, this.gm.fb_y - 84, 400, 18, 0xff000000, 0xff808080);
// drawRect(this.gm.fb_x / 2 - 191, this.gm.fb_y - 82, this.gm.fb_x / 2 + 191, this.gm.fb_y - 66, 0xff808080);
// drawRect(this.gm.fb_x / 2 - 190, this.gm.fb_y - 81, this.gm.fb_x / 2 + 190, this.gm.fb_y - 67, 0xff000000);
Drawing.drawTextCentered(this.warningMessage, this.gm.fb_x / 2, this.gm.fb_y - 84, 0xffff0000);
}
}