diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index d73b54b..5bcb246 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -394,7 +394,7 @@ public class Client implements IThreadListener { @Variable(name = "chunk_view_distance", category = CVarCategory.RENDER, min = 2, max = 16, callback = DistanceFunction.class, display = "Sichtweite", unit = "Chunks") public int renderDistance = 8; - @Variable(name = "chunk_build_time", category = CVarCategory.RENDER, min = 1, max = 100, display = "Max. Zeit für Chunk-Bau pro Frame", unit = "ms") + @Variable(name = "chunk_build_time", category = CVarCategory.RENDER, min = 1, max = 100, display = "Zeit für Chunk-Bau", unit = "ms") public int maxBuildTime = 8; @Variable(name = "gl_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1) public float fov = 70.0f; @@ -427,7 +427,7 @@ public class Client implements IThreadListener { public int mouse_x; public int mouse_y; - @Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1, max = 5, display = "Skalierung der Benutzeroberfläche", unit = "x", callback = RedrawFunction.class) + @Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1, max = 5, display = "Skalierung", unit = "x", callback = RedrawFunction.class) private int scale = 1; @Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%") @@ -439,19 +439,19 @@ public class Client implements IThreadListener { public DisplayMode vidMode; @Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms") public int dclickDelay = 250; - @Variable(name = "console_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = ConsoleFunction.class, display = "Nachrichten in der Konsole") + @Variable(name = "console_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = ConsoleFunction.class, display = "Nachrichten in Konsole") public int consoleSize = 32; @Variable(name = "chat_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = ChatFunction.class, display = "Nachrichten im Chat") public int chatSize = 32; @Variable(name = "feed_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = FeedFunction.class, display = "Nachrichten im Feed") public int feedSize = 8; - @Variable(name = "hotbar_size", category = CVarCategory.CONSOLE, min = 0, max = 16, callback = HotbarFunction.class, display = "Nachrichten in der Hotbar") + @Variable(name = "hotbar_size", category = CVarCategory.CONSOLE, min = 0, max = 16, callback = HotbarFunction.class, display = "Nachrichten in Hotbar") public int hotbarSize = 2; - @Variable(name = "overlay_fadeout", category = CVarCategory.CONSOLE, min = 1, max = 60, display = "Dauer bis zum Ausblenden", unit = "s") + @Variable(name = "overlay_fadeout", category = CVarCategory.CONSOLE, min = 1, max = 60, display = "Anzeigedauer", unit = "s") public int hudFadeout = 8; @Variable(name = "overlay_enabled", category = CVarCategory.CONSOLE, display = "Nachrichten-Overlay") public boolean hudOverlay = true; - @Variable(name = "chat_permanent", category = CVarCategory.CONSOLE, display = "Nachrichten im Chat immer einblenden") + @Variable(name = "chat_permanent", category = CVarCategory.CONSOLE, display = "Chat immer einblenden") public boolean chatPermanent = false; @Variable(name = "overlay_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund") public int hudOpacity = 0x40; @@ -461,7 +461,7 @@ public class Client implements IThreadListener { public boolean saving; public boolean drawFps; public boolean drawDebug; - @Variable(name = "gl_vsync_flush", category = CVarCategory.RENDER, display = "Puffer vor Synch. leeren") + @Variable(name = "gl_vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren") public boolean glFlush = false; @Variable(name = "con_autoclose", category = CVarCategory.CONSOLE, display = "Schließen") public boolean conAutoclose = true; @@ -470,7 +470,7 @@ public class Client implements IThreadListener { public Style style = Style.DEFAULT; @Variable(name = "gui_scroll_lines", category = CVarCategory.GUI, min = 1, max = 10, display = "Scrollbreite", unit = "Zeilen") public int scrollLines = 3; - @Variable(name = "gui_font_tiny", category = CVarCategory.GUI, display = "Kleine Schriftart", callback = FontFunction.class) + @Variable(name = "gui_font_tiny", category = CVarCategory.GUI, display = "Kleine Schrift", callback = FontFunction.class) public boolean tinyFont = false; @@ -482,9 +482,9 @@ public class Client implements IThreadListener { @Variable(name = "snd_enabled", category = CVarCategory.SOUND, display = "Tonausgabe") public boolean soundEnabled = true; - @Variable(name = "snd_buffer_size", category = CVarCategory.SOUND, min = 0, max = 1048576, display = "Puffergröße") + @Variable(name = "snd_buffer_size", category = CVarCategory.SOUND, min = 0, max = 1048576, display = "Puffer") public int soundBufferSize = 16384; - @Variable(name = "snd_frame_size", category = CVarCategory.SOUND, min = 2, max = 8192, display = "PCM-Intervall") + @Variable(name = "snd_frame_size", category = CVarCategory.SOUND, min = 2, max = 8192, display = "Intervall") public int soundFrameSize = 32; private String serverInfo; diff --git a/client/src/main/java/client/gui/GuiConfirm.java b/client/src/main/java/client/gui/GuiConfirm.java index 5439053..8ab9cd5 100755 --- a/client/src/main/java/client/gui/GuiConfirm.java +++ b/client/src/main/java/client/gui/GuiConfirm.java @@ -28,10 +28,10 @@ public class GuiConfirm extends Gui implements ButtonCallback { } public void init(int width, int height) { - this.add(new Label(0, 0, 700, 24, this.messageLine1)); + this.add(new Label(0, 0, 700, 0, this.messageLine1)); this.add(new TransparentArea(0, 80, 700, 300, this.messageLine2, this.gm.world != null && !this.gm.charEditor)); - this.confirmBtn = this.add(new ActButton(100, 500, 245, 24, this, this.confirmButtonText)); - this.cancelBtn = this.add(new ActButton(355, 500, 245, 24, this, this.cancelButtonText)); + this.confirmBtn = this.add(new ActButton(100, 500, 245, 0, this, this.confirmButtonText)); + this.cancelBtn = this.add(new ActButton(355, 500, 245, 0, this, this.cancelButtonText)); this.shift(); } diff --git a/client/src/main/java/client/gui/GuiConnect.java b/client/src/main/java/client/gui/GuiConnect.java index 1cfd886..cd468b7 100644 --- a/client/src/main/java/client/gui/GuiConnect.java +++ b/client/src/main/java/client/gui/GuiConnect.java @@ -264,12 +264,12 @@ public class GuiConnect extends GuiList implements Button } } - this.add(this.selectButton = new ActButton(width / 2 - 383, height - 28, 150, 24, this, "Verbinden")); - this.add(this.createButton = new ActButton(width - 204, 4, 200, 24, this, "Server hinzufügen ...")); - this.add(this.deleteButton = new ActButton(width / 2 - 75, height - 28, 150, 24, this, "Löschen")); - this.add(this.editButton = new ActButton(width / 2 + 79, height - 28, 150, 24, this, "Bearbeiten")); - this.add(this.copyButton = new ActButton(width / 2 - 229, height - 28, 150, 24, this, "Kopieren")); - this.add(new NavButton(width / 2 + 233, height - 28, 150, 24, GuiMenu.INSTANCE, "Abbrechen")); + this.add(this.selectButton = new ActButton(width / 2 - 383, height - 28, 150, 0, this, "Verbinden")); + this.add(this.createButton = new ActButton(width - 204, 4, 200, 0, this, "Server hinzufügen ...")); + this.add(this.deleteButton = new ActButton(width / 2 - 75, height - 28, 150, 0, this, "Löschen")); + this.add(this.editButton = new ActButton(width / 2 + 79, height - 28, 150, 0, this, "Bearbeiten")); + this.add(this.copyButton = new ActButton(width / 2 - 229, height - 28, 150, 0, this, "Kopieren")); + this.add(new NavButton(width / 2 + 233, height - 28, 150, 0, GuiMenu.INSTANCE, "Abbrechen")); this.selectButton.enabled = false; this.deleteButton.enabled = false; diff --git a/client/src/main/java/client/gui/GuiConsole.java b/client/src/main/java/client/gui/GuiConsole.java index dc579fa..673d90b 100644 --- a/client/src/main/java/client/gui/GuiConsole.java +++ b/client/src/main/java/client/gui/GuiConsole.java @@ -5,6 +5,7 @@ import java.util.List; import client.Client; import client.gui.element.ActButton; import client.gui.element.ButtonCallback; +import client.gui.element.Element; import client.gui.element.Fill; import client.gui.element.PressType; import client.gui.element.FieldAction; @@ -47,20 +48,20 @@ public class GuiConsole extends Gui implements FieldCallback { public void init(int width, int height) { if(this.full) { - this.addSelector("con_autoclose", 0, 0, 160, 24); - this.addSelector("con_timestamps", 160, 0, 160, 24); - this.addSelector("con_loglevel", 320, 0, 160, 24); - this.add(new ActButton(480, 0, 160, 24, new ButtonCallback() { + this.addSelector("con_autoclose", 0, 0, 160, 0); + this.addSelector("con_timestamps", 160, 0, 160, 0); + this.addSelector("con_loglevel", 320, 0, 160, 0); + this.add(new ActButton(480, 0, 160, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiConsole.this.reset(); GuiConsole.this.setLog(GuiConsole.this.gm.getBuffer()); } }, "Löschen")); } - this.logBox = this.add(new TransparentArea(0, this.full ? 24 : 0, width, height - (this.full ? 48 : 24), this.gm.getBuffer(), this.gm.world != null && !this.gm.charEditor)); + this.logBox = this.add(new TransparentArea(0, this.full ? Element.BASE_HEIGHT : 0, width, height - Element.BASE_HEIGHT * (this.full ? 2 : 1), this.gm.getBuffer(), this.gm.world != null && !this.gm.charEditor)); if(this.full) - this.add(new Fill(640, 0, width - 640, 24)); - this.inputField = this.add(new Field(0, height - 24, width, 24, IPlayer.MAX_CMD_LENGTH, this, "")); + this.add(new Fill(640, 0, width - 640, 0)); + this.inputField = this.add(new Field(0, height - Element.BASE_HEIGHT, width, 0, IPlayer.MAX_CMD_LENGTH, this, "")); this.inputField.setSelected(); this.sentHistoryCursor = this.sentMessages.size(); } diff --git a/client/src/main/java/client/gui/GuiInfo.java b/client/src/main/java/client/gui/GuiInfo.java index 97819dd..4241672 100644 --- a/client/src/main/java/client/gui/GuiInfo.java +++ b/client/src/main/java/client/gui/GuiInfo.java @@ -1,6 +1,7 @@ package client.gui; import client.Client; +import client.gui.element.Element; import client.gui.element.NavButton; import client.gui.element.TransparentArea; import common.Version; @@ -43,7 +44,7 @@ public class GuiInfo extends Gui { private static String getHeader(boolean hax, String normal, String hacked) { return (hax ? TextColor.RED : TextColor.YELLOW) + (hax ? hacked : normal) + "\n" + - (hax ? TextColor.CYAN : TextColor.WHITE) + "==========================================+=========================================="; + (hax ? TextColor.CYAN : TextColor.WHITE) + "==========================+=========================="; } private static void addLines(StringBuilder sb, boolean hax, String alternate, String category, String... authors) { @@ -128,7 +129,7 @@ public class GuiInfo extends Gui { public void init(int width, int height) { this.add(new TransparentArea(10, 10, width - 20, height - 44, this.info, this.gm.world != null && !this.gm.charEditor)); - this.add(new NavButton(0, height - 24, width, 24, GuiMenu.INSTANCE, "Zurück")); + this.add(new NavButton(0, height - Element.BASE_HEIGHT, width, 0, GuiMenu.INSTANCE, "Zurück")); } public String getTitle() { diff --git a/client/src/main/java/client/gui/GuiLoading.java b/client/src/main/java/client/gui/GuiLoading.java index f51592b..26f5b8a 100644 --- a/client/src/main/java/client/gui/GuiLoading.java +++ b/client/src/main/java/client/gui/GuiLoading.java @@ -46,11 +46,11 @@ public class GuiLoading extends Gui { } public void init(int width, int height) { - this.taskLabel = this.add(new Label(0, 40, 500, 20, "")); - this.progressBar1 = this.add(new Bar(0, 80, 500, 24)); - this.progressBar2 = this.add(new Bar(0, 120, 500, 24)); + this.taskLabel = this.add(new Label(0, 40, 500, 0, "")); + this.progressBar1 = this.add(new Bar(0, 80, 500, 0)); + this.progressBar2 = this.add(new Bar(0, 120, 500, 0)); this.shift(); - this.headerLabel = this.add(new Label(0, 40, width, 20, this.message)); + this.headerLabel = this.add(new Label(0, 40, width, 0, this.message)); this.progressBar1.visible = false; this.progressBar2.visible = false; } diff --git a/client/src/main/java/client/gui/GuiMenu.java b/client/src/main/java/client/gui/GuiMenu.java index 9a2268b..662e945 100644 --- a/client/src/main/java/client/gui/GuiMenu.java +++ b/client/src/main/java/client/gui/GuiMenu.java @@ -51,7 +51,7 @@ public class GuiMenu extends Gui { this.ticks = 0; this.hacked = 0; this.resetAnimation(); - this.add(new ActButton(0, -28, 400, 24, new ButtonCallback() { + this.add(new ActButton(0, 0, 170, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(action == PressType.SECONDARY) { GuiMenu.this.gm.joinDebugWorld(); @@ -66,8 +66,8 @@ public class GuiMenu extends Gui { } } }, "Server beitreten")); - this.add(new NavButton(0, 0, 400, 24, GuiServer.INSTANCE, "Schnellverbindung")); - this.add(new ActButton(0, 28, 400, 24, new ButtonCallback() { + this.add(new NavButton(0, 20, 170, 0, GuiServer.INSTANCE, "Schnellverbindung")); + this.add(new ActButton(0, 40, 170, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(GuiMenu.this.hacked == 8) GuiMenu.this.hacked++; @@ -75,11 +75,11 @@ public class GuiMenu extends Gui { GuiMenu.this.gm.displayGuiScreen(GuiOptions.getPage()); } }, "Einstellungen")); - this.infoButton = this.add(new ActButton(0, 56, 400, 24, new ButtonCallback() { + this.infoButton = this.add(new ActButton(0, 60, 170, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiMenu.this.gm.displayGuiScreen(GuiMenu.this.hacked == 10 ? GuiInfo.HAX : GuiInfo.INSTANCE); } - }, "Info / Über / Mitwirkende") { + }, "Info / Mitwirkende") { public void drawHover() { if(GuiMenu.this.hacked == 10) { Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x287f00ff); @@ -98,27 +98,27 @@ public class GuiMenu extends Gui { } } }); - this.add(new ActButton(0, 102, 400, 24, new ButtonCallback() { + this.add(new ActButton(0, 90, 170, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiMenu.this.gm.interrupted = true; } }, "Client schließen")); this.shift(); - this.add(new Label(4, /* this.gm.fb_y - 2 */ 0, 200, 20, TextColor.VIOLET + Client.VERSION, true)); - this.splashLabel = this.add(new Label(0, 160, width, 24, "")); + this.add(new Label(4, /* this.gm.fb_y - 2 */ 0, 200, 0, TextColor.VIOLET + Client.VERSION, true)); + this.splashLabel = this.add(new Label(0, 100, width, 0, "")); this.pickSplash(); } else { - this.add(new NavButton(0, 0, 400, 24, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Charakter-Editor" : "Zurück zum Spiel")); - this.add(new NavButton(0, 28, this.gm.charEditor ? 400 : 198, 24, GuiOptions.getPage(), "Einstellungen")); + this.add(new NavButton(0, 0, 170, 0, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Editor" : "Zurück zum Spiel")); + this.add(new NavButton(0, 20, 170, 0, GuiOptions.getPage(), "Einstellungen")); if(!this.gm.charEditor) - this.add(new NavButton(202, 28, 198, 24, GuiCharacters.INSTANCE, "Charakter")); - this.add(new ActButton(0, 102, 400, 24, new ButtonCallback() { + this.add(new NavButton(0, 40, 170, 0, GuiCharacters.INSTANCE, "Charakter")); + this.add(new ActButton(0, this.gm.charEditor ? 50 : 70, 170, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiMenu.this.gm.unload(true); // GuiMenu.this.gm.displayGuiScreen(INSTANCE); } - }, "Server verlassen und Verbindung trennen")); + }, "Server verlassen")); this.shift(); } } @@ -292,7 +292,7 @@ public class GuiMenu extends Gui { public void drawOverlays() { super.drawOverlays(); if(this.gm.world == null) { - int y = 164; + int y = 99; int h = 16; int n = Drawing.getWidth(this.splashLabel.getText()); Drawing.drawRect(0, y, this.gm.fb_x / 2 - n / 2 - 10, h, 0x7f7f00ff); diff --git a/client/src/main/java/client/gui/GuiServer.java b/client/src/main/java/client/gui/GuiServer.java index 9be22d0..70f9273 100644 --- a/client/src/main/java/client/gui/GuiServer.java +++ b/client/src/main/java/client/gui/GuiServer.java @@ -5,6 +5,7 @@ import java.security.PublicKey; import client.gui.GuiConnect.ServerInfo; import client.gui.element.ActButton; import client.gui.element.ButtonCallback; +import client.gui.element.Element; import client.gui.element.Label; import client.gui.element.NavButton; import client.gui.element.PasswordField; @@ -67,32 +68,32 @@ public class GuiServer extends Gui implements FieldCallback { public void init(int width, int height) { if(this.server != null) { - this.nameBox = this.add(new Field(0, -50, 400, 24, 128, this, this.server.getName())); + this.nameBox = this.add(new Field(0, -50, 400, 0, 128, this, this.server.getName())); this.keypair = this.server.getKeypair(); this.keyDigest = this.keypair == null ? null : EncryptUtil.getXorSha512Hash(this.keypair.getPublic().getEncoded()); } - this.addrBox = this.add(new Field(0, 20, 400, 24, 128, this, this.server == null ? this.lastAddr : this.server.getAddress())); + this.addrBox = this.add(new Field(0, 20, 400, 0, 128, this, this.server == null ? this.lastAddr : this.server.getAddress())); int port = this.server == null ? this.lastPort : this.server.getPort(); - this.portBox = this.add(new Field(404, 20, 76, 24, 5, this, port < 0 ? "" : "" + port)); - this.userBox = this.add(new Field(0, 70, 220, 24, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser())); - this.passBox = this.add(new PasswordField(0, this.server == null ? 120 : 170, 480, 24, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword())); - this.accBox = this.add(new PasswordField(0, this.server == null ? 170 : 220, 480, 24, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess())); - this.add(new ActButton(0, this.server == null ? 220 : 350, 480, 24, new ButtonCallback() { + this.portBox = this.add(new Field(404, 20, 76, 0, 5, this, port < 0 ? "" : "" + port)); + this.userBox = this.add(new Field(0, 70, 220, 0, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser())); + this.passBox = this.add(new PasswordField(0, this.server == null ? 120 : 170, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword())); + this.accBox = this.add(new PasswordField(0, this.server == null ? 170 : 220, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess())); + this.add(new ActButton(0, this.server == null ? 220 : 350, 480, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiServer.this.connect(); } }, this.server == null ? "Verbinden" : (this.server.getName().isEmpty() ? "Hinzufügen" : "Übernehmen"))); - this.add(new NavButton(0, this.server == null ? 250 : 380, 480, 24, this.server != null ? GuiConnect.INSTANCE : GuiMenu.INSTANCE, "Zurück")); + this.add(new NavButton(0, this.server == null ? 250 : 380, 480, 0, this.server != null ? GuiConnect.INSTANCE : GuiMenu.INSTANCE, "Zurück")); if(this.server != null) - this.nameLabel = this.add(new Label(0, -70, 410, 20, "Name in der Liste", true)); - this.addrLabel = this.add(new Label(0, 0, 410, 20, "Adresse / Hostname", true)); - this.portLabel = this.add(new Label(404, 0, 76, 20, "Port", true)); - this.rangeLabel = this.add(new Label(370, 44, 110, 20, "[1024..32767]", true)); - this.userLabel = this.add(new Label(0, 50, 220, 20, "Benutzername", true)); - this.passLabel = this.add(new Label(0, this.server == null ? 100 : 150, 480, 20, (this.keypair == null ? "Anmelde" : "Ersatz") + "-Passwort (mind. 8 Zeichen)", true)); - this.accLabel = this.add(new Label(0, this.server == null ? 150 : 200, 480, 20, "Server-Passwort (mind. 8 Zeichen)", true)); + this.nameLabel = this.add(new Label(0, -50, 410, "Name in der Liste", true)); + this.addrLabel = this.add(new Label(0, 20, 410, "Adresse / Hostname", true)); + this.portLabel = this.add(new Label(404, 20, 76, "Port", true)); + this.rangeLabel = this.add(new Label(370, 20 + Element.BASE_HEIGHT, 110, 0, "[1024..32767]", true)); + this.userLabel = this.add(new Label(0, 70, 220, "Benutzername", true)); + this.passLabel = this.add(new Label(0, this.server == null ? 120 : 170, 480, (this.keypair == null ? "Anmelde" : "Ersatz") + "-Passwort (mind. 8 Zeichen)", true)); + this.accLabel = this.add(new Label(0, this.server == null ? 170 : 220, 480, "Server-Passwort (mind. 8 Zeichen)", true)); if(this.server != null) { - this.keyButton = this.add(new ActButton(0, 120, 391, 24, new ButtonCallback() { + this.keyButton = this.add(new ActButton(0, 120, 391, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(GuiServer.this.keypair == null) { GuiServer.this.keypair = EncryptUtil.createKeypair(); @@ -147,19 +148,19 @@ public class GuiServer extends Gui implements FieldCallback { } } }, this.keypair == null ? "Neues Schlüsselpaar generieren" : "Schlüsselpaar entfernen")); - this.copyKeyButton = this.add(new ActButton(395, 120, 85, 24, new ButtonCallback() { + this.copyKeyButton = this.add(new ActButton(395, 120, 85, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(GuiServer.this.keypair != null) Window.setClipboard(EncryptUtil.getArmoredPubkey(GuiServer.this.keypair.getPublic(), GuiServer.this.userBox.getText())); } }, "Kopieren")); this.copyKeyButton.enabled = this.keypair != null; - this.keyLabel = this.add(new Label(0, 100, 480, 20, "Anmelde-Pubkey: " + (this.keypair != null ? "RSA-4096 " + this.keyDigest : "nicht vorhanden"), true)); - this.encToggle = this.add(new Toggle(0, 250, 480, 24, false, this.server.requiresEncryption(), null, "Nur Verschlüsselte Verbindung akzeptieren")); + this.keyLabel = this.add(new Label(0, 120, 480, "Anmelde-Pubkey: " + (this.keypair != null ? "RSA-4096 " + this.keyDigest : "nicht vorhanden"), true)); + this.encToggle = this.add(new Toggle(0, 250, 480, 0, false, this.server.requiresEncryption(), null, "Nur Verschlüsselte Verbindung akzeptieren")); this.serverKey = this.server.getServerKey(); this.serverDigest = this.serverKey == null ? null : EncryptUtil.getXorSha512Hash(this.serverKey.getEncoded()); - this.idLabel = this.add(new Label(0, 280, 480, 20, "Server-Pubkey: " + (this.serverKey != null ? "RSA-4096 " + this.serverDigest : "nicht vorhanden"), true)); - this.resetButton = this.add(new ActButton(0, 300, 391, 24, new ButtonCallback() { + this.idLabel = this.add(new Label(0, 300, 480, "Server-Pubkey: " + (this.serverKey != null ? "RSA-4096 " + this.serverDigest : "nicht vorhanden"), true)); + this.resetButton = this.add(new ActButton(0, 300, 391, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(GuiServer.this.serverKey != null) { GuiServer.this.serverKey = null; @@ -171,7 +172,7 @@ public class GuiServer extends Gui implements FieldCallback { } }, "Server-Identifizierung / Pubkey zurücksetzen")); this.resetButton.enabled = this.serverKey != null; - this.copyIdButton = this.add(new ActButton(395, 300, 85, 24, new ButtonCallback() { + this.copyIdButton = this.add(new ActButton(395, 300, 85, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(GuiServer.this.serverKey != null) Window.setClipboard(EncryptUtil.getArmoredPubkey(GuiServer.this.serverKey, GuiServer.this.nameBox.getText())); diff --git a/client/src/main/java/client/gui/Style.java b/client/src/main/java/client/gui/Style.java index db7435f..f9a2753 100644 --- a/client/src/main/java/client/gui/Style.java +++ b/client/src/main/java/client/gui/Style.java @@ -17,9 +17,9 @@ public enum Style implements Identifyable, Displayable { this.name = name; } - @Variable(type = IntType.COLOR, name = "color_border_top", category = CVarCategory.GUI, display = "Umrahmung oben / l.") + @Variable(type = IntType.COLOR, name = "color_border_top", category = CVarCategory.GUI, display = "Umrahmung A") public int brdr_top; - @Variable(type = IntType.COLOR, name = "color_border_btm", category = CVarCategory.GUI, display = "Umrahmung unten / r.") + @Variable(type = IntType.COLOR, name = "color_border_btm", category = CVarCategory.GUI, display = "Umrahmung B") public int brdr_btm; @Variable(type = IntType.COLOR, name = "color_button_top", category = CVarCategory.GUI, display = "Knopf oben") diff --git a/client/src/main/java/client/gui/character/GuiChar.java b/client/src/main/java/client/gui/character/GuiChar.java index 7a04ca4..7feb01b 100755 --- a/client/src/main/java/client/gui/character/GuiChar.java +++ b/client/src/main/java/client/gui/character/GuiChar.java @@ -277,7 +277,7 @@ public class GuiChar extends GuiList } this.currentSkin = this.gm.player != null && !EntityTexManager.hasCustomSkin(this.gm.player.getId()) ? this.gm.player.getChar() : null; this.load(this.gm.player == null ? ModelType.HUMANOID : this.gm.player.getModel(), this.gm.player != null ? this.gm.player.getSpecies() : SpeciesRegistry.CLASSES.get(EntityHuman.class)); - this.add(new ActButton(4, 4, 194, 24, new ButtonCallback() { + this.add(new ActButton(4, 4, 194, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiChar.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "Skin konvertieren", TEXTURE_FOLDER, new FileCallback() { public void selected(File file) { @@ -287,7 +287,7 @@ public class GuiChar extends GuiList }); } }, "Importieren: Standard")); - this.add(new ActButton(202, 4, 194, 24, new ButtonCallback() { + this.add(new ActButton(202, 4, 194, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiChar.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "Skin konvertieren (schlank)", TEXTURE_FOLDER, new FileCallback() { public void selected(File file) { @@ -297,13 +297,13 @@ public class GuiChar extends GuiList }); } }, "Importieren: Schlank")); - this.addSelector("char_filter_species", 400, 4, 300, 24); - this.add(new ActButton(4, height - 28, 194, 24, new ButtonCallback() { + this.addSelector("char_filter_species", 400, 4, 300, 0); + this.add(new ActButton(4, height - 28, 194, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiChar.this.gm.displayGuiScreen(GuiChar.this); } }, "Neu laden")); - this.templateButton = this.add(new ActButton(202, height - 28, 194, 24, new ButtonCallback() { + this.templateButton = this.add(new ActButton(202, height - 28, 194, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { SkinEntry skin = GuiChar.this.getSelected(); if(skin != null && skin.getLocation() != null) { @@ -339,18 +339,18 @@ public class GuiChar extends GuiList }, "Vorlage kopieren")); this.adjust = this.add(new DragAdjust(width / 2 - 230, height - 64 - 640, 460, 640)); - this.add(new Label(width - 396, 36, 392, 20, "Spezies: " + (this.gm.player == null ? "" : this.gm.player.getSpecies().name), true)); - this.add(new NavButton(width - 396, 56, 392, 24, GuiSpecies.INSTANCE, "Spezies ändern")); - this.add(new Label(width - 396, 36 + 92, 392, 20, "Klasse: " + (this.gm.player == null || this.gm.player.getSpecies().classEnum == null || this.gm.player.getNpcClass() == null || this.gm.player.getNpcClass().toString().isEmpty() ? "" : this.gm.player.getNpcClass().toString()), true)) + this.add(new Label(width - 396, 56, 392, "Spezies: " + (this.gm.player == null ? "" : this.gm.player.getSpecies().name), true)); + this.add(new NavButton(width - 396, 56, 392, 0, GuiSpecies.INSTANCE, "Spezies ändern")); + this.add(new Label(width - 396, 56 + 92, 392, "Klasse: " + (this.gm.player == null || this.gm.player.getSpecies().classEnum == null || this.gm.player.getNpcClass() == null || this.gm.player.getNpcClass().toString().isEmpty() ? "" : this.gm.player.getNpcClass().toString()), true)) .enabled = this.gm.player != null && this.gm.player.getSpecies().classEnum != null; - this.add(new NavButton(width - 396, 56 + 92, 392, 24, GuiClass.INSTANCE, "Klasse ändern")) + this.add(new NavButton(width - 396, 56 + 92, 392, 0, GuiClass.INSTANCE, "Klasse ändern")) .enabled = this.gm.player != null && this.gm.player.getSpecies().classEnum != null; final ActButton[] alignBtns = new ActButton[Alignment.values().length]; for (int z = 0; z < Alignment.values().length; z++) { final Alignment align = Alignment.values()[z]; - alignBtns[z] = this.add(new ActButton(width - 396 + (z % 3) * 132, height - 32 - 28 * 3 + 28 * (z / 3), 128, 24, new ButtonCallback() { + alignBtns[z] = this.add(new ActButton(width - 396 + (z % 3) * 132, height - 32 - 28 * 3 + 28 * (z / 3), 128, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(GuiChar.this.gm.player != null) { GuiChar.this.waiting = false; @@ -363,7 +363,7 @@ public class GuiChar extends GuiList }, align.color + align.display)); alignBtns[z].enabled = this.gm.player == null || this.gm.player.getAlignment() != align; } - this.add(new Slider(width / 2 - 200, height - 28, 400, 24, 1, this.gm.player == null ? 120 : this.gm.player.getMinSize(), this.gm.player == null ? 320 : this.gm.player.getMaxSize(), this.gm.player == null ? 180 : this.gm.player.getDefaultSize(), this.gm.player == null ? 180 : this.gm.player.getCurrentSize(), new SliderCallback() { + this.add(new Slider(width / 2 - 200, height - 28, 400, 0, 1, this.gm.player == null ? 120 : this.gm.player.getMinSize(), this.gm.player == null ? 320 : this.gm.player.getMaxSize(), this.gm.player == null ? 180 : this.gm.player.getDefaultSize(), this.gm.player == null ? 180 : this.gm.player.getCurrentSize(), new SliderCallback() { public void use(Slider elem, int value) { if(GuiChar.this.gm.player != null) { GuiChar.this.waiting = false; @@ -371,10 +371,10 @@ public class GuiChar extends GuiList } } }, "Spieler-Größe", "cm")).enabled = this.gm.player == null || this.gm.player.getMinSize() != this.gm.player.getMaxSize(); - this.add(new Label(width / 2 - 200, 36, 400, 20, "Name", true)); - this.add(new Label(width - 396, height - 384, 392, 20, "Beschreibung", true)); + this.add(new Label(width / 2 - 200, 36 + 20, 400, "Name", true)); + this.add(new Label(width - 396, height - 364, 392, "Beschreibung", true)); final Area descField = this.add(new Area(width - 396, height - 364, 392, 130, IPlayer.MAX_INFO_LENGTH, "")); - this.add(new ActButton(width - 198, height - 28, 194, 24, new ButtonCallback() { + this.add(new ActButton(width - 198, height - 28, 194, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(GuiChar.this.gm.player != null) { GuiChar.this.gm.displayGuiScreen(GuiLoading.makeWaitTask("Lade Welt ...")); @@ -384,7 +384,7 @@ public class GuiChar extends GuiList } } }, "Charakter erstellen")); - this.add(new Field(width / 2 - 200, 36 + 20, 400, 24, IPlayer.MAX_NICK_LENGTH, new FieldCallback() { + this.add(new Field(width / 2 - 200, 36 + 20, 400, 0, IPlayer.MAX_NICK_LENGTH, new FieldCallback() { public void use(Field elem, FieldAction value) { if(value == FieldAction.SEND || value == FieldAction.UNFOCUS) { String name = elem.getText(); @@ -411,7 +411,7 @@ public class GuiChar extends GuiList } } } - this.dimButton = this.add(new ActButton(width - 396, height - 220, 392, 24, new ButtonCallback() { + this.dimButton = this.add(new ActButton(width - 396, height - 220, 392, 0, new ButtonCallback() { public void use(ActButton elem, PressType mode) { if(mode == PressType.TERTIARY) { GuiChar.this.dimension = new Random().zrange(UniverseRegistry.getBaseDimensions().size()); @@ -427,7 +427,7 @@ public class GuiChar extends GuiList GuiChar.this.setDimButton(); } }, "")); - this.descLines = this.add(new TransparentArea(width - 396, height - 220 + 24, 392, 66, "", false)); + this.descLines = this.add(new TransparentArea(width - 396, height - 220 + Element.BASE_HEIGHT, 392, 66, "", false)); this.setDimButton(); } diff --git a/client/src/main/java/client/gui/character/GuiCharacters.java b/client/src/main/java/client/gui/character/GuiCharacters.java index 660dc0d..e80c593 100644 --- a/client/src/main/java/client/gui/character/GuiCharacters.java +++ b/client/src/main/java/client/gui/character/GuiCharacters.java @@ -79,9 +79,9 @@ public class GuiCharacters extends GuiList impleme this.elements.add(new CharacterEntry(null, false)); this.setSelected(ExtMath.clampi(selected, -1, this.elements.size() - 1)); this.descField = this.add(new TransparentArea(width - 390, 62, 380, height - 124, "", false)); - this.deleteButtom = this.add(new ActButton(width / 2 - 304, height - 28, 200, 24, this, "Charakter löschen")); - this.actionButtom = this.add(new ActButton(width / 2 - 100, height - 28, 200, 24, this, "")); - this.add(new NavButton(width / 2 + 104, height - 28, 200, 24, GuiMenu.INSTANCE, "Abbrechen")); + this.deleteButtom = this.add(new ActButton(width / 2 - 304, height - 28, 200, 0, this, "Charakter löschen")); + this.actionButtom = this.add(new ActButton(width / 2 - 100, height - 28, 200, 0, this, "")); + this.add(new NavButton(width / 2 + 104, height - 28, 200, 0, GuiMenu.INSTANCE, "Abbrechen")); this.updateButtons(); } diff --git a/client/src/main/java/client/gui/character/GuiClass.java b/client/src/main/java/client/gui/character/GuiClass.java index 9b83871..97cde18 100644 --- a/client/src/main/java/client/gui/character/GuiClass.java +++ b/client/src/main/java/client/gui/character/GuiClass.java @@ -50,8 +50,8 @@ public class GuiClass extends GuiList implements ButtonCall for(Enum clazz : this.gm.player.getSpecies().classEnum.getEnumConstants()) { this.elements.add(new ClassEntry(clazz)); } - this.add(new NavButton(width - 198 * 2, height - 28, 194, 24, GuiChar.INSTANCE, "Zurück")); - this.selectButton = this.add(new ActButton(width - 198, height - 28, 194, 24, this, "Klasse ändern")); + this.add(new NavButton(width - 198 * 2, height - 28, 194, 0, GuiChar.INSTANCE, "Zurück")); + this.selectButton = this.add(new ActButton(width - 198, height - 28, 194, 0, this, "Klasse ändern")); } public String getTitle() { diff --git a/client/src/main/java/client/gui/character/GuiSpecies.java b/client/src/main/java/client/gui/character/GuiSpecies.java index 10e8c01..1619b3d 100644 --- a/client/src/main/java/client/gui/character/GuiSpecies.java +++ b/client/src/main/java/client/gui/character/GuiSpecies.java @@ -54,8 +54,8 @@ public class GuiSpecies extends GuiList implements Butt for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) { this.elements.add(new SpeciesEntry(species)); } - this.add(new NavButton(width - 198 * 2, height - 28, 194, 24, GuiChar.INSTANCE, "Zurück")); - this.selectButton = this.add(new ActButton(width - 198, height - 28, 194, 24, this, "Spezies ändern")); + this.add(new NavButton(width - 198 * 2, height - 28, 194, 0, GuiChar.INSTANCE, "Zurück")); + this.selectButton = this.add(new ActButton(width - 198, height - 28, 194, 0, this, "Spezies ändern")); } public String getTitle() { diff --git a/client/src/main/java/client/gui/element/Dropdown.java b/client/src/main/java/client/gui/element/Dropdown.java index a49b053..2850a3b 100644 --- a/client/src/main/java/client/gui/element/Dropdown.java +++ b/client/src/main/java/client/gui/element/Dropdown.java @@ -82,7 +82,12 @@ public class Dropdown extends Element { } public Dropdown(int x, int y, int w, int h, boolean up, T[] values, T def, T init, DropdownCallback callback, final String text) { - this(x, y, w, h, up, values, def, init, callback, new Formatter>() { + this(x, y, w, h, up, values, def, init, callback, text == null ? new Formatter>() { + public String use(Dropdown elem) { + T value = elem.getValue(); + return value instanceof Displayable ? ((Displayable)value).getDisplay() : value.toString(); + } + } : new Formatter>() { public String use(Dropdown elem) { T value = elem.getValue(); return String.format("%s: %s", text, value instanceof Displayable ? ((Displayable)value).getDisplay() : value.toString()); diff --git a/client/src/main/java/client/gui/element/Element.java b/client/src/main/java/client/gui/element/Element.java index 3d25fb2..ae913b8 100644 --- a/client/src/main/java/client/gui/element/Element.java +++ b/client/src/main/java/client/gui/element/Element.java @@ -3,6 +3,7 @@ package client.gui.element; import org.lwjgl.opengl.GL11; import client.Client; +import client.gui.Font; import client.gui.Formatter; import client.gui.Gui; import client.renderer.Drawing; @@ -15,6 +16,8 @@ import common.sound.PositionedSound; import common.util.Util; public abstract class Element { + public static final int BASE_HEIGHT = 18; + protected final Client gm = Client.CLIENT; protected Gui gui; @@ -36,12 +39,11 @@ public abstract class Element { public boolean visible = true; public boolean enabled = true; - public Element(int x, int y, int w, int h, Formatter formatter) { this.pos_x = x; this.pos_y = y; this.size_x = w; - this.size_y = h; + this.size_y = h <= 0 ? BASE_HEIGHT : h; this.format = formatter; // gui_update_style(this, 1); // if(type != ElemType.SLIDER) { @@ -112,8 +114,8 @@ public abstract class Element { public void updateText() { Vec2i size = Drawing.getSize(this.text); - this.text_x = (this.size_x - size.xpos) / 2; - this.text_y = (this.size_y - size.ypos) / 2; + this.text_x = ((this.size_x - (this.margin_x1 + this.margin_x2)) - size.xpos) / 2; + this.text_y = ((this.size_y - (this.margin_y1 + this.margin_y2)) - size.ypos + 1) / 2; } public void setText(String str) { diff --git a/client/src/main/java/client/gui/element/Fill.java b/client/src/main/java/client/gui/element/Fill.java index 5fecb12..7067dcf 100644 --- a/client/src/main/java/client/gui/element/Fill.java +++ b/client/src/main/java/client/gui/element/Fill.java @@ -50,8 +50,8 @@ public class Fill extends Element { public void updateText() { Vec2i size = Drawing.getSize(this.text); if(!this.left) - this.text_x = (this.size_x - size.xpos) / 2; + this.text_x = ((this.size_x - (this.margin_x1 + this.margin_x2)) - size.xpos) / 2; if(!this.top) - this.text_y = (this.size_y - size.ypos) / 2; + this.text_y = ((this.size_y - (this.margin_y1 + this.margin_y2)) - size.ypos + 1) / 2; } } diff --git a/client/src/main/java/client/gui/element/Label.java b/client/src/main/java/client/gui/element/Label.java index 7420a1d..b371741 100644 --- a/client/src/main/java/client/gui/element/Label.java +++ b/client/src/main/java/client/gui/element/Label.java @@ -4,16 +4,30 @@ import client.renderer.Drawing; import common.util.Util; public class Label extends Fill { + public static final int LABEL_HEIGHT = 14; + public Label(int x, int y, int w, int h, String text, boolean top, boolean left) { - super(x, y, w, h, text, top, left); + super(x, y, w, h <= 0 ? LABEL_HEIGHT : h, text, top, left); } public Label(int x, int y, int w, int h, String text, boolean left) { - super(x, y, w, h, text, left); + super(x, y, w, h <= 0 ? LABEL_HEIGHT : h, text, left); } public Label(int x, int y, int w, int h, String text) { - super(x, y, w, h, text); + super(x, y, w, h <= 0 ? LABEL_HEIGHT : h, text); + } + + public Label(int x, int y, int w, String text, boolean top, boolean left) { + super(x, y - LABEL_HEIGHT, w, LABEL_HEIGHT, text, top, left); + } + + public Label(int x, int y, int w, String text, boolean left) { + super(x, y - LABEL_HEIGHT, w, LABEL_HEIGHT, text, left); + } + + public Label(int x, int y, int w, String text) { + super(x, y - LABEL_HEIGHT, w, LABEL_HEIGHT, text); } protected void drawBackground() { diff --git a/client/src/main/java/client/gui/element/Slider.java b/client/src/main/java/client/gui/element/Slider.java index 347cef9..5df5d99 100644 --- a/client/src/main/java/client/gui/element/Slider.java +++ b/client/src/main/java/client/gui/element/Slider.java @@ -7,7 +7,7 @@ import common.util.ExtMath; import common.util.Util; public class Slider extends Element { - private static final int SLIDER_WIDTH = 10; + private static final int SLIDER_WIDTH = 8; private final SliderCallback func; private final int def; @@ -21,7 +21,7 @@ public class Slider extends Element { public Slider(int x, int y, int w, int h, int prec, int min, int max, int def, int init, SliderCallback callback, Formatter formatter) { super(x, y, w, h, formatter); - this.handle = ((this.size_y * SLIDER_WIDTH) / 24) & ~1; + this.handle = ((this.size_y * SLIDER_WIDTH) / BASE_HEIGHT) & ~1; this.func = callback; this.precision = prec; this.min = min; diff --git a/client/src/main/java/client/gui/ingame/GuiForm.java b/client/src/main/java/client/gui/ingame/GuiForm.java index 94c2671..e64bd18 100644 --- a/client/src/main/java/client/gui/ingame/GuiForm.java +++ b/client/src/main/java/client/gui/ingame/GuiForm.java @@ -32,14 +32,14 @@ public class GuiForm extends Gui implements ButtonCallback { private boolean sent; public void init(int width, int height) { - this.add(new Label(0, -100, 300, 20, this.title)); + this.add(new Label(0, -100, 300, 0, this.title)); for(int z = 0; z < this.inputs.length; z++) { final int index = z; final String name = this.inputData[z].first(); Object obj = this.inputData[z].second(); int param = this.inputData[z].third(); if(obj instanceof Boolean) { - this.inputs[z] = this.add(new Toggle(0, 50 * z, 300, 24, (Boolean)obj, (Boolean)obj, new ToggleCallback() { + this.inputs[z] = this.add(new Toggle(0, 50 * z, 300, 0, (Boolean)obj, (Boolean)obj, new ToggleCallback() { public void use(Toggle elem, boolean value) { GuiForm.this.outputData[index] = value; } @@ -48,7 +48,7 @@ public class GuiForm extends Gui implements ButtonCallback { else if(obj instanceof String[]) { final String[] strs = (String[])obj; param = ExtMath.clampi(param, 0, strs.length - 1); - this.inputs[z] = this.add(new Switch(0, 50 * z, 300, 24, strs, strs[param], strs[param], new SwitchCallback() { + this.inputs[z] = this.add(new Switch(0, 50 * z, 300, 0, strs, strs[param], strs[param], new SwitchCallback() { public void use(Switch elem, String value) { for(int n = 0; n < strs.length; n++) { if(value == strs[n]) { @@ -60,19 +60,19 @@ public class GuiForm extends Gui implements ButtonCallback { }, name)); } else { - this.labels[z] = this.add(new Label(0, 50 * z - 20, 300, 20, name, true)); + this.labels[z] = this.add(new Label(0, 50 * z, 300, name, true)); FieldCallback callback = new FieldCallback() { public void use(Field elem, FieldAction value) { if(value == FieldAction.FOCUS) GuiForm.this.labels[index].setText(name); } }; - this.inputs[z] = this.add((param & 0x80000000) != 0 ? new PasswordField(0, 50 * z, 300, 24, Math.min(param & 0xffff, 1024), callback, (String)obj) : - new Field(0, 50 * z, 300, 24, Math.min(param & 0xffff, 1024), callback, (String)obj)); + this.inputs[z] = this.add((param & 0x80000000) != 0 ? new PasswordField(0, 50 * z, 300, 0, Math.min(param & 0xffff, 1024), callback, (String)obj) : + new Field(0, 50 * z, 300, 0, Math.min(param & 0xffff, 1024), callback, (String)obj)); } } - this.add(new NavButton(0, 50 * (this.inputs.length + 1), 148, 24, null, "Abbrechen")); - this.add(new ActButton(152, 50 * (this.inputs.length + 1), 148, 24, this, "Senden")); + this.add(new NavButton(0, 50 * (this.inputs.length + 1), 148, 0, null, "Abbrechen")); + this.add(new ActButton(152, 50 * (this.inputs.length + 1), 148, 0, this, "Senden")); this.shift(); } diff --git a/client/src/main/java/client/gui/ingame/GuiGameOver.java b/client/src/main/java/client/gui/ingame/GuiGameOver.java index ce3f7ab..25c90ec 100755 --- a/client/src/main/java/client/gui/ingame/GuiGameOver.java +++ b/client/src/main/java/client/gui/ingame/GuiGameOver.java @@ -18,9 +18,9 @@ public class GuiGameOver extends Gui { public void init(int width, int height) { this.timer = 0; - this.add(new Label(0, 0, 200, 20, "Du bist gestorben!")); - this.add(new Label(0, 32, 200, 20, "Punktestand: " + TextColor.YELLOW + this.gm.player.experienceLevel)); - this.button = this.add(new ActButton(0, 100, 200, 24, new ButtonCallback() { + this.add(new Label(0, 0, 200, 0, "Du bist gestorben!")); + this.add(new Label(0, 32, 200, 0, "Punktestand: " + TextColor.YELLOW + this.gm.player.experienceLevel)); + this.button = this.add(new ActButton(0, 100, 200, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiGameOver.this.gm.player.respawnPlayer(); GuiGameOver.this.gm.displayGuiScreen(null); diff --git a/client/src/main/java/client/gui/ingame/GuiSign.java b/client/src/main/java/client/gui/ingame/GuiSign.java index c5530fd..1e3d59d 100644 --- a/client/src/main/java/client/gui/ingame/GuiSign.java +++ b/client/src/main/java/client/gui/ingame/GuiSign.java @@ -16,13 +16,13 @@ public class GuiSign extends Gui implements FieldCallback { private final String[] tempLines; public void init(int width, int height) { - this.add(new Label(0, -140, 300, 20, "Bearbeite Schild")); - this.add(new Label(0, -80, 300, 20, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ()))); - this.add(new Label(0, -50, 300, 20, this.gm.world == null ? "" : this.gm.world.dimension.getFormattedName(false))); + this.add(new Label(0, -140, 300, 0, "Bearbeite Schild")); + this.add(new Label(0, -80, 300, 0, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ()))); + this.add(new Label(0, -50, 300, 0, this.gm.world == null ? "" : this.gm.world.dimension.getFormattedName(false))); for(int z = 0; z < this.lines.length; z++) { - this.lines[z] = this.add(new Field(0, 40 * z, 300, 24, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z])); + this.lines[z] = this.add(new Field(0, 40 * z, 300, 0, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z])); } - this.add(new NavButton(0, 40 * (this.lines.length + 1), 300, 24, null, "Fertig")); + this.add(new NavButton(0, 40 * (this.lines.length + 1), 300, 0, null, "Fertig")); this.shift(); } diff --git a/client/src/main/java/client/gui/options/GuiBinds.java b/client/src/main/java/client/gui/options/GuiBinds.java index ffc6262..2face9d 100644 --- a/client/src/main/java/client/gui/options/GuiBinds.java +++ b/client/src/main/java/client/gui/options/GuiBinds.java @@ -16,8 +16,8 @@ public class GuiBinds extends GuiOptions { int y = 0; int x = 0; for(Bind bind : Bind.values()) { - this.add(new Label(10 + x * 190, 80 + y * 50, 180, 20, bind.getDisplay())); - this.add(new ActButton(10 + x * 190, 100 + y * 50, 180, 24, new ButtonCallback() { + this.add(new Label(x * 152, 100 + y * 34, 150, bind.getDisplay())); + this.add(new ActButton(x * 152, 100 + y * 34, 150, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(action == PressType.SECONDARY) { if(!bind.isDefault()) { @@ -45,13 +45,13 @@ public class GuiBinds extends GuiOptions { return (bind.isDupe() ? TextColor.RED : TextColor.YELLOW) + (bind.getInput() == null ? "---" : bind.getInput().getDisplay()); } })); - if(++x == 5) { + if(++x == 4) { x = 0; y++; } } y += x != 0 ? 1 : 0; - this.add(new ActButton(200, 100 + y * 50, 560, 24, new ButtonCallback() { + this.add(new ActButton(0, 100 + y * 34, 150 * 4 + 2 * 3, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { boolean flag = false; for(Bind bind : Bind.values()) { @@ -64,8 +64,8 @@ public class GuiBinds extends GuiOptions { } } }, "Zurücksetzen")); - this.addSelector("phy_sensitivity", 30, 160 + y * 50, 440, 24); - this.addSelector("gui_dclick_delay", 490, 160 + y * 50, 440, 24); + this.addSelector("phy_sensitivity", 0, 140 + y * 34, 302, 0); + this.addSelector("gui_dclick_delay", 304, 140 + y * 34, 302, 0); super.init(width, height); } diff --git a/client/src/main/java/client/gui/options/GuiDisplay.java b/client/src/main/java/client/gui/options/GuiDisplay.java index 585ae0f..bdbc48e 100644 --- a/client/src/main/java/client/gui/options/GuiDisplay.java +++ b/client/src/main/java/client/gui/options/GuiDisplay.java @@ -25,6 +25,11 @@ public class GuiDisplay extends GuiOptions { } public void init(int width, int height) { + this.add(new Toggle(0, 0, 240, 0, false, GuiDisplay.this.gm.fullscreen, new ToggleCallback() { + public void use(Toggle elem, boolean value) { + GuiDisplay.this.gm.full(value); + } + }, "Vollbild")); int maxModes = ExtMath.clampi((height - 120) / Font.YGLYPH, 4, 28); DisplayMode[] dmodes = Window.getDisplayModes(); if(dmodes != null && dmodes.length > 0) { @@ -42,23 +47,18 @@ public class GuiDisplay extends GuiOptions { if(modes[z].equals(this.gm.vidMode)) selected = modes[z]; } - this.add(new Dropdown(30, 80, 440, 24, false, modes, modes[modes.length - 1], selected, new DropdownCallback() { + this.add(new Dropdown(242, 0, 240, 0, false, modes, modes[modes.length - 1], selected, new DropdownCallback() { public void use(Dropdown elem, DisplayMode value) { GuiDisplay.this.gm.vidMode = value; GuiDisplay.this.gm.full(true); } - }, "Auflösung")); + }, (String)null)); } else { - this.add(new Fill(30, 80, 440, 24, TextColor.RED + "Auflösung: ")); + this.add(new Fill(242, 0, 240, 0, TextColor.RED + "")); } - this.add(new Toggle(490, 80, 440, 24, false, GuiDisplay.this.gm.fullscreen, new ToggleCallback() { - public void use(Toggle elem, boolean value) { - GuiDisplay.this.gm.full(value); - } - }, "Vollbild")); - this.add(new Slider(30, 120, 440, 24, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() { + this.add(new Slider(0, 20, 240, 0, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() { public void use(Slider elem, int value) { GuiDisplay.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0))); GuiDisplay.this.gm.setDirty(); @@ -69,24 +69,24 @@ public class GuiDisplay extends GuiOptions { return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync")); } })); - this.addSelector("gl_vsync_flush", 490, 120, 440, 24); + this.addSelector("gl_vsync_flush", 242, 20, 240, 0); - this.addSelector("overlay_enabled", 30, 200, 440, 24); - this.addSelector("overlay_opacity", 490, 200, 440, 24); + this.addSelector("overlay_enabled", 0, 50, 240, 0); + this.addSelector("overlay_opacity", 242, 50, 240, 0); - this.addSelector("overlay_fadeout", 30, 240, 440, 24); - this.addSelector("chat_permanent", 490, 240, 440, 24); + this.addSelector("overlay_fadeout", 0, 70, 240, 0); + this.addSelector("chat_permanent", 242, 70, 240, 0); - this.addSelector("console_size", 30, 280, 440, 24); - this.addSelector("chat_size", 490, 280, 440, 24); + this.addSelector("console_size", 0, 90, 240, 0); + this.addSelector("chat_size", 242, 90, 240, 0); - this.addSelector("feed_size", 30, 320, 440, 24); - this.addSelector("hotbar_size", 490, 320, 440, 24); + this.addSelector("feed_size", 0, 110, 240, 0); + this.addSelector("hotbar_size", 242, 110, 240, 0); - this.addSelector("gl_fov", 30, 400, 440, 24); - this.addSelector("gui_scale", 490, 400, 440, 24); - this.distanceSlider = this.addSelector("chunk_view_distance", 30, 440, 440, 24); - this.addSelector("chunk_build_time", 490, 440, 440, 24); + this.addSelector("gl_fov", 0, 140, 240, 0); + + this.distanceSlider = this.addSelector("chunk_view_distance", 0, 160, 240, 0); + this.addSelector("chunk_build_time", 242, 160, 240, 0); super.init(width, height); } @@ -100,7 +100,7 @@ public class GuiDisplay extends GuiOptions { String str = distance < 0 ? DISTANCES[0] : DISTANCES[(distance + 1) / 4]; if(distance > 2 && (((distance + 1) / 2) & 1) == 1) str = str + "+"; - return String.format("Sichtweite: %d Chunks [%d Blöcke, %s]", this.gm.renderDistance, this.gm.renderDistance * 16, str); + return String.format("Sichtweite: %d [%d, %s]", this.gm.renderDistance, this.gm.renderDistance * 16, str); } public void updateScreen() { diff --git a/client/src/main/java/client/gui/options/GuiOptions.java b/client/src/main/java/client/gui/options/GuiOptions.java index bcff178..022cb5e 100644 --- a/client/src/main/java/client/gui/options/GuiOptions.java +++ b/client/src/main/java/client/gui/options/GuiOptions.java @@ -2,6 +2,7 @@ package client.gui.options; import client.gui.Gui; import client.gui.GuiMenu; +import client.gui.element.Element; import client.gui.element.NavButton; public abstract class GuiOptions extends Gui { @@ -16,16 +17,10 @@ public abstract class GuiOptions extends Gui { public void init(int width, int height) { lastPage = this; this.shift(); - int x = 0; - int y = 0; for(int z = 0; z < PAGES.length; z++) { GuiOptions gui = PAGES[z]; - this.add(new NavButton(z == PAGES.length - 1 ? width - 210 : 210 * x, 24 * y, 210, 24, gui, gui.getTitle())); - if(++x == 4) { - x = 0; - ++y; - } + this.add(new NavButton(z % 2 == 1 ? width - 210 : 0, 20 * (z / 2), 210, 0, gui, gui.getTitle())); } - this.add(new NavButton(210, height - 24, width - 420, 24, GuiMenu.INSTANCE, "Zurück")); + this.add(new NavButton(210, height - Element.BASE_HEIGHT, width - 420, 0, GuiMenu.INSTANCE, "Zurück")); } } diff --git a/client/src/main/java/client/gui/options/GuiSound.java b/client/src/main/java/client/gui/options/GuiSound.java index 29a3814..9e49c02 100644 --- a/client/src/main/java/client/gui/options/GuiSound.java +++ b/client/src/main/java/client/gui/options/GuiSound.java @@ -10,25 +10,26 @@ public class GuiSound extends GuiOptions { } public void init(int width, int height) { - this.addSelector("snd_enabled", 30, 380, 440, 24); + int x = 0; + int y = 0; + for(Volume volume : Volume.values()) { + this.addSelector(volume.getCVarName(), x, y, 150, 0); + x = (x == 0) ? 152 : 0; + if(x == 0) + y += 20; + } - this.addSelector("snd_buffer_size", 30, 420, 440, 24); - this.addSelector("snd_frame_size", 490, 420, 440, 24); + this.addSelector("snd_enabled", 0, 50, 150, 0); + + this.addSelector("snd_buffer_size", 0, 70, 150, 0); + this.addSelector("snd_frame_size", 152, 70, 150, 0); - this.add(new ActButton(30, 480, 900, 24, new ButtonCallback() { + this.add(new ActButton(0, 100, 302, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiSound.this.gm.restartSound(false); } - }, "Übernehmen und Audio-Thread neu starten")); + }, "Übernehmen und Audio neu starten")); - int x = 30; - int y = 220; - for(Volume volume : Volume.values()) { - this.addSelector(volume.getCVarName(), x, y, 440, 24); - x = (x == 30) ? 490 : 30; - if(x == 30) - y += 40; - } super.init(width, height); } diff --git a/client/src/main/java/client/gui/options/GuiStyle.java b/client/src/main/java/client/gui/options/GuiStyle.java index db064b5..df62b65 100644 --- a/client/src/main/java/client/gui/options/GuiStyle.java +++ b/client/src/main/java/client/gui/options/GuiStyle.java @@ -43,7 +43,7 @@ public class GuiStyle extends GuiOptions implements DropdownCallback, Bu if(cv instanceof ColorVar) { ColorVar color = (ColorVar)cv; if(!color.getDisplay().isEmpty()) - this.add(color.label(x, y - 20, w, 20)); + this.add(color.label(x, y, w)); if(this.gm.style != Style.CUSTOM) return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style))); else @@ -55,7 +55,7 @@ public class GuiStyle extends GuiOptions implements DropdownCallback, Bu public void init(int width, int height) { int z; for(z = 0; z < STYLE_CVARS.length; z++) { - this.addSelector(STYLE_CVARS[z], 10 + ((z % 3) + 1) * 190, 100 + z / 3 * 50, 180, 24); + this.addSelector(STYLE_CVARS[z], (z % 3) * 122, z / 3 * 34, 120, 0); } z = 0; for(Style theme : Style.values()) { @@ -68,25 +68,16 @@ public class GuiStyle extends GuiOptions implements DropdownCallback, Bu } } }; - this.add( // theme == this.gm.style ? new SelectedButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 24, callback, theme.name) : - new SelectableButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 24, callback, theme.name, theme == this.gm.style)); + this.add( // theme == this.gm.style ? new SelectedButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 0, callback, theme.name) : + new SelectableButton((z % 3) * 122, 4 * 34 + (z / 3) * 20, 120, 0, callback, theme.name, theme == this.gm.style)); z++; } - - this.addSelector("gui_font_tiny", 10, height - 124, 300, 24); - String[] values = new String[] {"VALUE 1", "VALUE 2"}; - this.add(new Dropdown(10, height - 74, 300, 24, false, values, values[1], values[0], this, "DROPDOWN")); - this.add(new ActButton(330, height - 74, 300, 24, this, "BUTTON")); - this.add(new Toggle(650, height - 74, 140, 24, false, true, this, "TOGGLE")); - this.add(new Toggle(810, height - 74, 140, 24, true, false, this, "TOGGLE")); - values = new String[] {"VALUE 1", "VALUE 2", "VALUE 3", "VALUE 4"}; - this.add(new Switch(10, height - 34, 300, 24, values, values[2], values[0], this, "ENUM")); - this.add(new Slider(330, height - 34, 300, 24, 0, -20, 827, 60, 120, this, "SLIDER")); - this.add(new Field(650, height - 34, 300, 24, 128, this, "FIELD")); + this.addSelector("gui_scale", 0, 5 * 34 + (Style.values().length / 3) * 20, 181, 0); + this.addSelector("gui_font_tiny", 183, 5 * 34 + (Style.values().length / 3) * 20, 181, 0); if(this.gm.style != Style.CUSTOM) { - this.add(new ActButton(200, 100 + 3 * 50, 560, 24, new ButtonCallback() { + this.add(new ActButton(0, 3 * 34, 364, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { if(GuiStyle.this.gm.style != Style.CUSTOM) { GuiStyle.this.gm.style.copyToCustom(); @@ -98,7 +89,7 @@ public class GuiStyle extends GuiOptions implements DropdownCallback, Bu }, "In angepasstes Design kopieren")); } else { - this.add(new ActButton(200, 100 + 3 * 50, 560, 24, new ButtonCallback() { + this.add(new ActButton(0, 3 * 34, 364, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiStyle.this.gm.style = Style.CUSTOM; for(String cvar : STYLE_CVARS) { diff --git a/client/src/main/java/client/renderer/tileentity/TileEntitySignRenderer.java b/client/src/main/java/client/renderer/tileentity/TileEntitySignRenderer.java index deabd4a..8f3ed06 100755 --- a/client/src/main/java/client/renderer/tileentity/TileEntitySignRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/TileEntitySignRenderer.java @@ -2,7 +2,6 @@ package client.renderer.tileentity; import org.lwjgl.opengl.GL11; -import client.gui.Font; import client.renderer.Drawing; import client.renderer.GlState; import client.renderer.model.ModelSign; diff --git a/client/src/main/java/client/vars/ColorVar.java b/client/src/main/java/client/vars/ColorVar.java index 9f72dc6..be15feb 100644 --- a/client/src/main/java/client/vars/ColorVar.java +++ b/client/src/main/java/client/vars/ColorVar.java @@ -39,8 +39,8 @@ public class ColorVar extends IntVar { throw new UnsupportedOperationException("Kann keinen Schieberegler für Farben erstellen"); } - public Label label(int x, int y, int w, int h) { - return new Label(x, y, w, h, this.display); + public Label label(int x, int y, int w) { + return new Label(x, y, w, this.display); } public client.gui.element.Field editor(int x, int y, int w, int h) { diff --git a/client/src/main/java/client/window/Bind.java b/client/src/main/java/client/window/Bind.java index 1ab509f..ce4dfd2 100644 --- a/client/src/main/java/client/window/Bind.java +++ b/client/src/main/java/client/window/Bind.java @@ -13,7 +13,7 @@ public enum Bind implements Identifyable, CVar { LEFT("left", "Nach links", Keysym.A), BACKWARD("backward", "Rückwärts", Keysym.S), RIGHT("right", "Nach rechts", Keysym.D), - UP("up", "Aufwärts, Springen", Keysym.SPACE), + UP("up", "Aufwärts, Sprung", Keysym.SPACE), DOWN("down", "Abwärts, Langsam", Keysym.LEFT_CONTROL), FAST("fast", "Schneller", Keysym.LEFT_SHIFT), INVENTORY("inventory", "Inventar", Keysym.E), @@ -34,7 +34,7 @@ public enum Bind implements Identifyable, CVar { CONSOLE("console", "Konsole", Keysym.F1), COMMAND("command", "Befehl / Chat", Keysym.C), INFO("info", "Infos einblenden", Keysym.TAB), - PERSPECTIVE("perspective", "Perspektive ändern", Keysym.F5), + PERSPECTIVE("perspective", "Perspektive", Keysym.F5), ZOOM("zoom", "Kamera zoomen", Keysym.Y), MENU("menu", "Menü", Keysym.ESCAPE), SCREENSHOT("screenshot", "Bildschirmfoto", Keysym.F10), diff --git a/client/src/main/java/client/window/Button.java b/client/src/main/java/client/window/Button.java index 5286196..a38c696 100644 --- a/client/src/main/java/client/window/Button.java +++ b/client/src/main/java/client/window/Button.java @@ -5,9 +5,9 @@ import client.Client; public enum Button implements Input { MOUSE_LEFT("lmb", "Linke Maustaste"), MOUSE_RIGHT("rmb", "Rechte Maustaste"), - MOUSE_MIDDLE("mmb", "Mittlere Maustaste"), - MOUSE_BTN_X("xmb", "Maustaste Seite 1"), - MOUSE_BTN_Y("ymb", "Maustaste Seite 2"), + MOUSE_MIDDLE("mmb", "Mausrad-Taste"), + MOUSE_BTN_X("xmb", "Maus Seite 1"), + MOUSE_BTN_Y("ymb", "Maus Seite 2"), MOUSE_BTN_A("m6", "Maustaste 6"), MOUSE_BTN_B("m7", "Maustaste 7"), MOUSE_BTN_C("m8", "Maustaste 8"); diff --git a/client/src/main/java/client/window/Wheel.java b/client/src/main/java/client/window/Wheel.java index 3c4b6bd..1fc5c26 100644 --- a/client/src/main/java/client/window/Wheel.java +++ b/client/src/main/java/client/window/Wheel.java @@ -3,8 +3,8 @@ package client.window; import client.Client; public enum Wheel implements Input { - SCROLL_UP("scrup", "Mausrad aufwärts"), - SCROLL_DOWN("scrdn", "Mausrad abwärts"), + SCROLL_UP("scrup", "Mausrad oben"), + SCROLL_DOWN("scrdn", "Mausrad unten"), SCROLL_LEFT("scrl", "Mausrad links"), SCROLL_RIGHT("scrr", "Mausrad rechts"); diff --git a/client/src/main/resources/textures/font_old.png b/client/src/main/resources/textures/font_old.png deleted file mode 100644 index 05f56ec..0000000 Binary files a/client/src/main/resources/textures/font_old.png and /dev/null differ