1
0
Fork 0

revert gui element height changes

This commit is contained in:
Sen 2025-09-04 11:19:40 +02:00
parent f566d62bd8
commit 6a663e5b6d
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
18 changed files with 212 additions and 167 deletions

View file

@ -288,10 +288,11 @@ public class Client implements IThreadListener {
Client.CLIENT.setMidiDebug();
}
}
public static class LightFunction implements FloatFunction {
public void apply(FloatVar cv, float value) {
Client.CLIENT.renderer.loadRenderers();
public static class MidiVisFunction implements BoolFunction {
public void apply(BoolVar cv, boolean value) {
if(Client.CLIENT.open instanceof GuiPlayer)
Client.CLIENT.rescale();
}
}
@ -625,7 +626,7 @@ public class Client implements IThreadListener {
@Variable(name = "gui_scroll_lines", category = CVarCategory.GUI, min = 1, max = 10, display = "Scrollbreite", unit = "Zeilen")
public int scrollLines = 3;
@Variable(name = "gui_font", category = CVarCategory.GUI, display = "Schriftart", callback = FontFunction.class)
private Font font = Font.SMALL;
private Font font = Font.LARGE;
@Variable(name = "draw_downfall_range", category = CVarCategory.RENDER, min = 0, max = 15, display = "Niederschlag-Radius")
public int downfallRange = 4;
@ -678,7 +679,7 @@ public class Client implements IThreadListener {
public MidiBank midiBank = MidiBank.DMX_DMX;
@Variable(name = "mid_debug_events", category = CVarCategory.SOUND, display = "MIDI-Debug", callback = MidiDebugFunction.class)
public boolean midiDebug = false;
@Variable(name = "mid_visualizer", category = CVarCategory.SOUND, display = "Visualisation")
@Variable(name = "mid_visualizer", category = CVarCategory.SOUND, display = "Visualisation", callback = MidiVisFunction.class)
public boolean midiVisualizer = true;
@Variable(name = "mid_ch_16_workaround", category = CVarCategory.SOUND, display = "Kanal 16 als Perkussion")
public boolean midiCh16Drums = false;
@ -2626,6 +2627,7 @@ public class Client implements IThreadListener {
public void restartSound(boolean load) {
Client.this.logFeed("Lade Sound-System " + (load ? "und alle Sounds " : "") + "neu");
GuiPlayer.INSTANCE.stop();
this.soundManager.unload();
if(this.audio.end())
Log.SOUND.info("Audiogerät geschlossen");

View file

@ -21,6 +21,15 @@ public abstract class Gui {
public static final String BACKGROUND = "textures/background.png";
public static final int HOVER_COLOR = 0x288080ff;
public static final int PRESS_COLOR = 0x30afafff;
public static final int BASE_HEIGHT = 24;
public static final int BASE_WIDTH = 320;
public static final int BASE_GAP = 2;
public static final int SEPARATOR_GAP = BASE_GAP + 8;
public static final int LABEL_GAP = BASE_GAP + 16;
public static final int BASE_SHIFT = BASE_HEIGHT + BASE_GAP;
public static final int SEPARATOR_SHIFT = BASE_HEIGHT + SEPARATOR_GAP;
public static final int LABEL_SHIFT = BASE_HEIGHT + LABEL_GAP;
public static final int H_SHIFT = BASE_WIDTH + BASE_GAP;
protected final Client gm = Client.CLIENT;

View file

@ -31,8 +31,8 @@ public class GuiConfirm extends Gui implements ButtonCallback {
public void init(int width, int height) {
this.add(new Label(0, 0, 700, 0, this.messageLine1));
this.add(new MultiLabel(0, 40, 700, 300, this.messageLine2, true));
this.confirmBtn = this.add(new ActButton(100, 400, 245, 0, this, this.confirmButtonText));
this.cancelBtn = this.add(new ActButton(355, 400, 245, 0, this, this.cancelButtonText));
this.confirmBtn = this.add(new ActButton(350 - BASE_WIDTH - BASE_GAP / 2, 400, 0, 0, this, this.confirmButtonText));
this.cancelBtn = this.add(new ActButton(350 + BASE_GAP / 2, 400, 0, 0, this, this.cancelButtonText));
this.shift();
}

View file

@ -183,7 +183,7 @@ public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements Button
public void init(int width, int height) {
super.init(width, height);
this.setDimensions(width, height, 32, height - 32);
this.setDimensions(width, height, BASE_HEIGHT + BASE_GAP * 2, height - BASE_HEIGHT - BASE_GAP * 2);
this.elements.clear();
if(SERVERS_FILE.exists()) {
try {
@ -264,12 +264,12 @@ public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements Button
}
}
this.add(this.selectButton = new ActButton(width / 2 - 379, height - 30, 150, 0, this, "Verbinden"));
this.add(this.createButton = new ActButton(width - 202, 12, 200, 0, this, "Server hinzufügen ..."));
this.add(this.deleteButton = new ActButton(width / 2 - 75, height - 30, 150, 0, this, "Löschen"));
this.add(this.editButton = new ActButton(width / 2 + 77, height - 30, 150, 0, this, "Bearbeiten"));
this.add(this.copyButton = new ActButton(width / 2 - 227, height - 30, 150, 0, this, "Kopieren"));
this.add(new NavButton(width / 2 + 229, height - 30, 150, 0, GuiMenu.INSTANCE, "Abbrechen"));
this.add(this.selectButton = new ActButton(width / 2 - 379, height - BASE_SHIFT, 150, 0, this, "Verbinden"));
this.add(this.createButton = new ActButton(width - 202, BASE_GAP, 200, 0, this, "Server hinzufügen ..."));
this.add(this.deleteButton = new ActButton(width / 2 - 75, height - BASE_SHIFT, 150, 0, this, "Löschen"));
this.add(this.editButton = new ActButton(width / 2 + 77, height - BASE_SHIFT, 150, 0, this, "Bearbeiten"));
this.add(this.copyButton = new ActButton(width / 2 - 227, height - BASE_SHIFT, 150, 0, this, "Kopieren"));
this.add(new NavButton(width / 2 + 229, height - BASE_SHIFT, 150, 0, GuiMenu.INSTANCE, "Abbrechen"));
this.selectButton.enabled = false;
this.deleteButton.enabled = false;

View file

@ -95,10 +95,10 @@ public class GuiConsole extends Gui implements FieldCallback {
}
}, "Löschen"));
}
this.logBox = this.add(new ConsoleArea(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));
this.logBox = this.add(new ConsoleArea(0, this.full ? BASE_HEIGHT : 0, width, height - 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, 0, ""));
this.inputField = this.add(new Field(0, height - Element.BASE_HEIGHT, width, 0, IPlayer.MAX_CMD_LENGTH, this, ""));
this.inputField = this.add(new Field(0, height - BASE_HEIGHT, width, 0, IPlayer.MAX_CMD_LENGTH, this, ""));
this.inputField.setSelected();
this.sentHistoryCursor = this.sentMessages.size();
}

View file

@ -104,8 +104,8 @@ public class GuiInfo extends Gui {
}
public void init(int width, int height) {
this.add(new MultiLabel(10, 10, width - 20, height - 44, this.info, false));
this.add(new NavButton((width - 280) / 2, height - 20, 280, 0, GuiMenu.INSTANCE, "Zurück"));
this.add(new MultiLabel(SEPARATOR_GAP, SEPARATOR_GAP, width - SEPARATOR_GAP * 2, height - BASE_SHIFT - SEPARATOR_GAP * 2, this.info, false));
this.add(new NavButton((width - BASE_WIDTH) / 2, height - BASE_SHIFT, 0, 0, GuiMenu.INSTANCE, "Zurück"));
}
public String getTitle() {

View file

@ -5,6 +5,7 @@ import client.gui.character.GuiChar;
import client.gui.character.GuiCharacters;
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.PressType;
@ -48,11 +49,12 @@ public class GuiMenu extends Gui {
private boolean animStep;
public void init(int width, int height) {
int y = 0;
if(this.gm.world == null) {
this.ticks = 0;
this.hacked = 0;
this.resetAnimation();
this.add(new ActButton(0, 0, 180, 0, new ButtonCallback() {
this.add(new ActButton(0, y, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(action == PressType.SECONDARY) {
GuiMenu.this.gm.joinDebugWorld();
@ -67,7 +69,7 @@ public class GuiMenu extends Gui {
}
}
}, "Server beitreten"));
this.add(new ActButton(0, 20, 180, 0, new ButtonCallback() {
this.add(new ActButton(0, y += BASE_SHIFT, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiMenu.this.hacked == 8)
GuiMenu.this.hacked++;
@ -75,9 +77,9 @@ public class GuiMenu extends Gui {
GuiMenu.this.gm.show(GuiServer.INSTANCE);
}
}, "Schnellverbindung"));
this.add(new NavButton(0, 40, 180, 0, GuiPlayer.INSTANCE, "MIDI-Player"));
this.add(new NavButton(0, 60, 180, 0, GuiOptions.getPage(), "Einstellungen"));
this.infoButton = this.add(new ActButton(0, 80, 180, 0, new ButtonCallback() {
this.add(new NavButton(0, y += BASE_SHIFT, 0, 0, GuiPlayer.INSTANCE, "MIDI-Player"));
this.add(new NavButton(0, y += BASE_SHIFT, 0, 0, GuiOptions.getPage(), "Einstellungen"));
this.infoButton = this.add(new ActButton(0, y += BASE_SHIFT, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiMenu.this.gm.show(GuiMenu.this.hacked == 10 ? GuiInfo.HAX : GuiInfo.INSTANCE);
}
@ -100,7 +102,7 @@ public class GuiMenu extends Gui {
}
}
});
this.add(new ActButton(0, 110, 180, 0, new ButtonCallback() {
this.add(new ActButton(0, y += SEPARATOR_SHIFT, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiMenu.this.gm.interrupted = true;
}
@ -111,12 +113,12 @@ public class GuiMenu extends Gui {
this.pickSplash();
}
else {
this.add(new NavButton(0, 0, 180, 0, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Editor" : "Zurück zum Spiel"));
this.add(new NavButton(0, 20, 180, 0, GuiPlayer.INSTANCE, "MIDI-Player"));
this.add(new NavButton(0, 40, 180, 0, GuiOptions.getPage(), "Einstellungen"));
this.add(new NavButton(0, y, 0, 0, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Editor" : "Zurück zum Spiel"));
this.add(new NavButton(0, y += BASE_SHIFT, 0, 0, GuiPlayer.INSTANCE, "MIDI-Player"));
this.add(new NavButton(0, y += BASE_SHIFT, 0, 0, GuiOptions.getPage(), "Einstellungen"));
if(!this.gm.charEditor)
this.add(new NavButton(0, 60, 180, 0, GuiCharacters.INSTANCE, "Charakter")).enabled = !(this.gm.player instanceof EntityCameraHolder);
this.add(new ActButton(0, this.gm.charEditor ? 70 : 90, 180, 0, new ButtonCallback() {
this.add(new NavButton(0, y += BASE_SHIFT, 0, 0, GuiCharacters.INSTANCE, "Charakter")).enabled = !(this.gm.player instanceof EntityCameraHolder);
this.add(new ActButton(0, y += SEPARATOR_SHIFT, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiMenu.this.gm.unload(true);
// GuiMenu.this.gm.displayGuiScreen(INSTANCE);

View file

@ -86,11 +86,12 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
Font.unset();
return Font.SMALL.getHeight();
}
protected void drawBackground() {
}
protected void drawForeground(int x1, int y1, int x2, int y2) {
gui_render_grad(0, 0, this.size_x, this.size_y, this.gm.style.field_btm, this.gm.style.field_top);
if(!this.gm.midiVisualizer)
return;
// gui_render_grad(0, 0, this.size_x, this.size_y, this.gm.style.field_btm, this.gm.style.field_top);
MidiDecoder midi = this.gm.getAudioInterface().alGetMidi();
if(midi == null)
return;
@ -405,60 +406,61 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
public void init(int width, int height) {
super.init(width, height);
this.setDimensions(360, height, 18, height - 18);
this.add(new NavButton(0, 0, 60, 18, GuiMenu.INSTANCE, "Zurück"));
this.add(new Fill(60, 0, 142, 18, "OPL MIDI Player"));
this.addSelector("mid_visualizer", 202, 0, 158, 18);
this.add(new NavButton(0, 0, 180, 0, GuiMenu.INSTANCE, "Zurück"));
this.add(new Fill(180, 0, width - 180 * 2, 0, "OPL MIDI Player"));
this.addSelector("mid_visualizer", width - 180, 0, 180, 0);
int x = 0;
this.playButton = this.add(new ActButton(0, height - 18, 18, 18, new ButtonCallback() {
this.playButton = this.add(new ActButton(x, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.play();
}
}, "*"));
this.stopButton = this.add(new ActButton(18, height - 18, 18, 18, new ButtonCallback() {
this.stopButton = this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.stop();
}
}, "#"));
this.modeButton = this.add(new ActButton(36, height - 18, 18, 18, new ButtonCallback() {
this.modeButton = this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.mode(action == PressType.TERTIARY ? 0 : (action == PressType.SECONDARY ? -1 : 1));
}
}, ""));
this.add(new ActButton(54, height - 18, 18, 18, new ButtonCallback() {
this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.prev();
}
}, "<"));
this.add(new ActButton(72, height - 18, 18, 18, new ButtonCallback() {
this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.next();
}
}, ">"));
this.add(new ActButton(90, height - 18, 18, 18, new ButtonCallback() {
this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.random();
}
}, "?"));
this.add(new ActButton(108, height - 18, 18, 18, new ButtonCallback() {
this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.select();
}
}, "~"));
this.add(new ActButton(126, height - 18, 18, 18, new ButtonCallback() {
this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.remove();
}
}, "-"));
this.add(new ActButton(144, height - 18, 18, 18, new ButtonCallback() {
this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.clear();
}
}, "X"));
this.addSelector("mid_opl_bank", 162, height - 18, 162, -18);
this.add(new ActButton(324, height - 18, 18, 18, new ButtonCallback() {
this.addSelector("mid_opl_bank", x += BASE_HEIGHT, height - BASE_HEIGHT, 162, -BASE_HEIGHT);
this.add(new ActButton(x += 162, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "MIDIs laden", null, new FileCallback() {
public void selected(File file) {
@ -467,7 +469,7 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
});
}
}, "+"));
this.add(new ActButton(342, height - 18, 18, 18, new ButtonCallback() {
this.add(new ActButton(x += BASE_HEIGHT, height - BASE_HEIGHT, BASE_HEIGHT, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiPlayer.this.gm.showFileDialog(FileMode.DIRECTORY_LOAD, "MIDIs laden", null, new FileCallback() {
public void selected(File file) {
@ -481,7 +483,10 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
// GuiPlayer.this.test(0, 255, 500, 36);
// }
// }, "MIDI-Bank testen"));
this.add(new Visualizer(360, 0, width - 360, height));
this.add(new Fill(x += BASE_HEIGHT, height - BASE_HEIGHT, width - x, 0, ""));
this.setDimensions(this.gm.midiVisualizer ? x : width, height, BASE_HEIGHT, height - BASE_HEIGHT);
if(this.gm.midiVisualizer)
this.add(new Visualizer(x, BASE_HEIGHT, width - x, height - BASE_HEIGHT * 2));
this.updateDisplay();
}

View file

@ -11,6 +11,7 @@ import client.gui.element.NavButton;
import client.gui.element.PasswordField;
import client.gui.element.PressType;
import client.gui.element.Toggle;
import client.renderer.Drawing;
import client.gui.element.FieldAction;
import client.gui.element.Field;
import client.gui.element.FieldCallback;
@ -67,32 +68,33 @@ public class GuiServer extends Gui implements FieldCallback {
private String lastAcc = "";
public void init(int width, int height) {
int y = 0;
if(this.server != null) {
this.nameBox = this.add(new Field(0, 0, 400, 0, 128, this, this.server.getName()));
this.nameLabel = this.add(new Label(0, 0, 410, "Name in der Liste", true));
this.keypair = this.server.getKeypair();
this.keyDigest = this.keypair == null ? null : EncryptUtil.getXorSha512Hash(this.keypair.getPublic().getEncoded());
this.serverKey = this.server.getServerKey();
this.serverDigest = this.serverKey == null ? null : EncryptUtil.getXorSha512Hash(this.serverKey.getEncoded());
this.nameBox = this.add(new Field(0, y, 400, 0, 128, this, this.server.getName()));
this.nameLabel = this.add(new Label(0, y, 410, "Name in der Liste", true));
y += LABEL_SHIFT;
}
this.addrBox = this.add(new Field(0, 34, 400, 0, 128, this, this.server == null ? this.lastAddr : this.server.getAddress()));
this.addrLabel = this.add(new Label(0, 34, 410, "Adresse / Hostname", true));
this.addrBox = this.add(new Field(0, y, 400, 0, 128, this, this.server == null ? this.lastAddr : this.server.getAddress()));
this.addrLabel = this.add(new Label(0, y, 410, "Adresse / Hostname", true));
int port = this.server == null ? this.lastPort : this.server.getPort();
this.portBox = this.add(new Field(404, 34, 76, 0, 5, this, port < 0 ? "" : "" + port));
this.portLabel = this.add(new Label(404, 34, 76, "Port", true));
this.rangeLabel = this.add(new Label(370, 34 + Element.BASE_HEIGHT, 110, 0, "[1024..32767]", true));
this.userBox = this.add(new Field(0, 68, 220, 0, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser()));
this.userLabel = this.add(new Label(0, 68, 220, "Benutzername", true));
this.passBox = this.add(new PasswordField(0, this.server == null ? 102 : 136, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword()));
this.passLabel = this.add(new Label(0, this.server == null ? 102 : 136, 480, (this.keypair == null ? "Anmelde" : "Ersatz") + "-Passwort (mind. 8 Zeichen)", true));
this.accBox = this.add(new PasswordField(0, this.server == null ? 136 : 170, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess()));
this.accLabel = this.add(new Label(0, this.server == null ? 136 : 170, 480, "Server-Passwort (mind. 8 Zeichen)", true));
this.add(new ActButton(241, this.server == null ? 166 : 254, 239, 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 ? 166 : 254, 239, 0, this.server != null ? GuiConnect.INSTANCE : GuiMenu.INSTANCE, "Zurück"));
this.portBox = this.add(new Field(404, y, 76, 0, 5, this, port < 0 ? "" : "" + port));
this.portLabel = this.add(new Label(404, y, 76, "Port", true));
String label = "[1024..32767]";
int shift = Drawing.getWidth(label);
this.rangeLabel = this.add(new Label(480 - shift, y + BASE_HEIGHT, shift, 0, label, true));
this.userBox = this.add(new Field(0, y += LABEL_SHIFT, 220, 0, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser()));
this.userLabel = this.add(new Label(0, y, 220, "Benutzername", true));
if(this.server != null) {
this.keyButton = this.add(new ActButton(0, 102, 391, 0, new ButtonCallback() {
this.keyButton = this.add(new ActButton(0, y += LABEL_SHIFT, 391, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiServer.this.keypair == null) {
GuiServer.this.keypair = EncryptUtil.createKeypair();
@ -147,18 +149,26 @@ public class GuiServer extends Gui implements FieldCallback {
}
}
}, this.keypair == null ? "Neues Schlüsselpaar generieren" : "Schlüsselpaar entfernen"));
this.copyKeyButton = this.add(new ActButton(395, 102, 85, 0, new ButtonCallback() {
this.copyKeyButton = this.add(new ActButton(395, y, 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, 102, 480, "Anmelde-Pubkey: " + (this.keypair != null ? EncryptUtil.KEY_ALGO_DISPLAY + " " + this.keyDigest : "nicht vorhanden"), true));
this.encToggle = this.add(new Toggle(0, 190, 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.resetButton = this.add(new ActButton(0, 224, 391, 0, new ButtonCallback() {
this.keyLabel = this.add(new Label(0, y, 480, "Anmelde-Pubkey: " + (this.keypair != null ? EncryptUtil.KEY_ALGO_DISPLAY + " " + this.keyDigest : "nicht vorhanden"), true));
}
this.passBox = this.add(new PasswordField(0, y += LABEL_SHIFT, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword()));
this.passLabel = this.add(new Label(0, y, 480, (this.keypair == null ? "Anmelde" : "Ersatz") + "-Passwort (mind. 8 Zeichen)", true));
this.accBox = this.add(new PasswordField(0, y += LABEL_SHIFT, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess()));
this.accLabel = this.add(new Label(0, y, 480, "Server-Passwort (mind. 8 Zeichen)", true));
if(this.server != null) {
this.encToggle = this.add(new Toggle(0, y += SEPARATOR_SHIFT, 480, 0, false, this.server.requiresEncryption(), null, "Nur Verschlüsselte Verbindung akzeptieren"));
this.resetButton = this.add(new ActButton(0, y += LABEL_SHIFT, 391, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiServer.this.serverKey != null) {
GuiServer.this.serverKey = null;
@ -170,15 +180,22 @@ 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, 224, 85, 0, new ButtonCallback() {
this.copyIdButton = this.add(new ActButton(395, y, 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()));
}
}, "Kopieren"));
this.copyIdButton.enabled = this.serverKey != null;
this.idLabel = this.add(new Label(0, 224, 480, "Server-Pubkey: " + (this.serverKey != null ? EncryptUtil.KEY_ALGO_DISPLAY + " " + this.serverDigest : "nicht vorhanden"), true));
this.idLabel = this.add(new Label(0, y, 480, "Server-Pubkey: " + (this.serverKey != null ? EncryptUtil.KEY_ALGO_DISPLAY + " " + this.serverDigest : "nicht vorhanden"), true));
}
this.add(new ActButton(241, y += SEPARATOR_SHIFT, 239, 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, y, 239, 0, this.server != null ? GuiConnect.INSTANCE : GuiMenu.INSTANCE, "Zurück"));
this.shift();
}

View file

@ -446,7 +446,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
GuiChar.this.setDimButton();
}
}, ""));
this.descLines = this.add(new MultiLabel(width - 390, height - 156 + Element.BASE_HEIGHT, 388, 42, "", true));
this.descLines = this.add(new MultiLabel(width - 390, height - 156 + BASE_HEIGHT, 388, 42, "", true));
this.setDimButton();
}

View file

@ -15,8 +15,6 @@ 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;
@ -41,8 +39,8 @@ public abstract class Element {
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 <= 0 ? BASE_HEIGHT : h;
this.size_x = w <= 0 ? Gui.BASE_WIDTH : w;
this.size_y = h <= 0 ? Gui.BASE_HEIGHT : h;
this.format = formatter;
// gui_update_style(this, 1);
// if(type != ElemType.SLIDER) {

View file

@ -1,6 +1,7 @@
package client.gui.element;
import client.gui.Formatter;
import client.gui.Gui;
import client.renderer.Drawing;
import client.window.Button;
import common.util.ExtMath;
@ -21,7 +22,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<Slider> formatter) {
super(x, y, w, h, formatter);
this.handle = ((this.size_y * SLIDER_WIDTH) / BASE_HEIGHT) & ~1;
this.handle = ((this.size_y * SLIDER_WIDTH) / Gui.BASE_HEIGHT) & ~1;
this.func = callback;
this.precision = prec;
this.min = min;

View file

@ -13,12 +13,15 @@ public class GuiBinds extends GuiOptions {
}
public void init(int width, int height) {
int cols = 5;
int y = 0;
int x = 0;
int x = -1;
for(Bind bind : Bind.values()) {
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() {
if(++x == 4) {
x = 0;
y += LABEL_SHIFT;
}
this.add(new Label(x * ((BASE_WIDTH - BASE_GAP) / 2 + BASE_GAP), y, (BASE_WIDTH - BASE_GAP) / 2, bind.getDisplay()));
this.add(new ActButton(x * ((BASE_WIDTH - BASE_GAP) / 2 + BASE_GAP), y, (BASE_WIDTH - BASE_GAP) / 2, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(action == PressType.SECONDARY) {
if(!bind.isDefault()) {
@ -46,14 +49,9 @@ public class GuiBinds extends GuiOptions {
return (bind.isDupe() ? Color.RED : Color.YELLOW) + (bind.getInput() == null ? "---" : bind.getInput().getDisplay());
}
}));
if(++x == cols) {
x = 0;
y++;
}
}
y += x != 0 ? 1 : 0;
x = (150 * cols + 2 * (cols - 1) - 482) / 2;
this.add(new ActButton(x, 96 + y * 34, 240, 0, new ButtonCallback() {
this.add(new ActButton(0, y += SEPARATOR_SHIFT, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
boolean flag = false;
for(Bind bind : Bind.values()) {
@ -66,9 +64,11 @@ public class GuiBinds extends GuiOptions {
}
}
}, "Tasten zurücksetzen"));
this.addSelector("phy_sensitivity", x + 242, 96 + y * 34, 240, 0);
this.addSelector("gui_dclick_delay", x, 116 + y * 34, 240, 0);
this.addSelector("gui_scroll_lines", x + 242, 116 + y * 34, 240, 0);
this.addSelector("phy_sensitivity", H_SHIFT, y, 0, 0);
this.addSelector("gui_dclick_delay", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("gui_scroll_lines", H_SHIFT, y, 0, 0);
super.init(width, height);
}

View file

@ -5,26 +5,28 @@ public class GuiDisplay extends GuiOptions {
}
public void init(int width, int height) {
this.addSelector("overlay_enabled", 0, 0, 240, 0);
this.addSelector("overlay_opacity", 242, 0, 240, 0);
int y = 0;
this.addSelector("overlay_fadeout", 0, 20, 240, 0);
this.addSelector("chat_permanent", 242, 20, 240, 0);
this.addSelector("overlay_enabled", 0, y, 0, 0);
this.addSelector("overlay_opacity", H_SHIFT, y, 0, 0);
this.addSelector("console_size", 0, 40, 240, 0);
this.addSelector("chat_size", 242, 40, 240, 0);
this.addSelector("overlay_fadeout", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("chat_permanent", H_SHIFT, y, 0, 0);
this.addSelector("feed_size", 0, 60, 240, 0);
this.addSelector("hotbar_size", 242, 60, 240, 0);
this.addSelector("console_size", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("chat_size", H_SHIFT, y, 0, 0);
this.addSelector("crosshair_simple", 0, 90, 240, 0);
this.addSelector("crosshair_size", 242, 90, 240, 0);
this.addSelector("feed_size", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("hotbar_size", H_SHIFT, y, 0, 0);
this.addSelector("crosshair_simple", 0, y += SEPARATOR_SHIFT, 0, 0);
this.addSelector("crosshair_size", H_SHIFT, y, 0, 0);
this.addSelector("crosshair_color_notarget", 0, 125, 240, 0);
this.addSelector("crosshair_color_target", 242, 125, 240, 0);
this.addSelector("crosshair_color_notarget", 0, y += LABEL_SHIFT, 0, 0);
this.addSelector("crosshair_color_target", H_SHIFT, y, 0, 0);
this.addSelector("hud_margin", 0, 145, 240, 0);
this.addSelector("gui_scale_hotbar", 242, 145, 240, 0);
this.addSelector("hud_margin", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("gui_scale_hotbar", H_SHIFT, y, 0, 0);
super.init(width, height);
}

View file

@ -34,7 +34,9 @@ public class GuiGraphics extends GuiOptions {
}
public void init(int width, int height) {
this.add(new Toggle(0, 0, 240, 0, false, GuiGraphics.this.gm.fullscreen, new ToggleCallback() {
int y = 0;
this.add(new Toggle(0, y, 0, 0, false, GuiGraphics.this.gm.fullscreen, new ToggleCallback() {
public void use(Toggle elem, boolean value) {
GuiGraphics.this.gm.full(value);
}
@ -57,7 +59,7 @@ public class GuiGraphics extends GuiOptions {
if(mode.equals(this.gm.vidMode))
selected = mode;
}
this.add(new Dropdown<DisplayMode>(242, 0, 240, 0, false, modes.toArray(new DisplayMode[modes.size()]), modes.get(modes.size() - 1), selected, new DropdownCallback<DisplayMode>() {
this.add(new Dropdown<DisplayMode>(H_SHIFT, y, 0, 0, false, modes.toArray(new DisplayMode[modes.size()]), modes.get(modes.size() - 1), selected, new DropdownCallback<DisplayMode>() {
public void use(Dropdown<DisplayMode> elem, DisplayMode value) {
GuiGraphics.this.gm.vidMode = value;
GuiGraphics.this.gm.full(true);
@ -66,9 +68,9 @@ public class GuiGraphics extends GuiOptions {
}
}
if(dmodes == null)
this.add(new Fill(242, 0, 240, 0, Color.RED + "<?>"));
this.add(new Fill(H_SHIFT, y, 0, 0, Color.RED + "<?>"));
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() {
this.add(new Slider(0, y += BASE_SHIFT, 0, 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) {
GuiGraphics.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0)));
GuiGraphics.this.gm.setDirty();
@ -79,31 +81,31 @@ public class GuiGraphics extends GuiOptions {
return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync"));
}
}));
this.addSelector("vsync_flush", 242, 20, 240, 0);
this.addSelector("vsync_flush", H_SHIFT, y, 0, 0);
this.distanceLabel = this.add(new Label(0, 55, 240, ""));
this.addSelector("chunk_view_distance", 0, 55, 240, 0);
this.fovLabel = this.add(new Label(242, 55, 240, ""));
this.addSelector("draw_fov", 242, 55, 240, 0);
this.distanceLabel = this.add(new Label(0, y += LABEL_SHIFT, 0, ""));
this.addSelector("chunk_view_distance", 0, y, 0, 0);
this.fovLabel = this.add(new Label(H_SHIFT, y, 0, ""));
this.addSelector("draw_fov", H_SHIFT, y, 0, 0);
this.addSelector("chunk_light_range", 0, 75, 240, 0);
this.addSelector("chunk_light_updates", 242, 75, 240, 0);
this.addSelector("chunk_light_range", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("chunk_light_updates", H_SHIFT, y, 0, 0);
this.addSelector("chunk_light_onload", 0, 95, 240, 0);
this.addSelector("chunk_build_time", 242, 95, 240, 0);
this.addSelector("chunk_light_onload", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("chunk_build_time", H_SHIFT, y, 0, 0);
this.addSelector("draw_player_firstperson", 0, 115, 240, 0);
this.addSelector("draw_player_firstperson", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("draw_downfall_range", 0, 135, 240, 0);
this.addSelector("draw_rain_particle_range", 242, 135, 240, 0);
this.addSelector("draw_downfall_range", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("draw_rain_particle_range", H_SHIFT, y, 0, 0);
this.addSelector("draw_void_particles", 0, 155, 240, 0);
this.addSelector("draw_void_fog", 242, 155, 240, 0);
this.addSelector("draw_void_particles", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("draw_void_fog", H_SHIFT, y, 0, 0);
if(this.gm.shaders)
this.addSelector("draw_use_shader", 0, 175, 240, 0);
this.addSelector("draw_use_shader", 0, y += BASE_SHIFT, 0, 0);
else
this.add(new Fill(0, 175, 240, 0, Color.RED + "Shader nicht unterstützt"));
this.add(new Fill(0, y += BASE_SHIFT, 0, 0, Color.RED + "Shader nicht unterstützt"));
super.init(width, height);
}

View file

@ -18,8 +18,8 @@ public abstract class GuiOptions extends Gui {
this.shift();
for(int z = 0; z < PAGES.length; z++) {
GuiOptions gui = PAGES[z];
this.add(new NavButton(z % 2 == 1 ? width - 212 : 2, 2 + 20 * (z / 2), 210, 0, gui, gui.getTitle()));
this.add(new NavButton(z % 2 == 1 ? width - H_SHIFT : BASE_GAP, BASE_GAP + BASE_SHIFT * (z / 2), 0, 0, gui, gui.getTitle()));
}
this.add(new NavButton((width - 280) / 2, height - 20, 280, 0, GuiMenu.INSTANCE, "Zurück"));
this.add(new NavButton((width - BASE_WIDTH) / 2, height - BASE_SHIFT, 0, 0, GuiMenu.INSTANCE, "Zurück"));
}
}

View file

@ -10,40 +10,44 @@ public class GuiSound extends GuiOptions {
}
public void init(int width, int height) {
this.addSelector("mid_opl_voices", 0, 0, 240, 0);
this.addSelector("mid_opl_bank", 242, 0, 240, 0);
int y = 0;
this.addSelector("mid_opl_voices", 0, y, 0, 0);
this.addSelector("mid_opl_bank", H_SHIFT, y, 0, 0);
int x = 0;
int y = 30;
y += SEPARATOR_SHIFT;
for(Volume volume : Volume.values()) {
this.addSelector(volume.getCVarName(), x, y, 240, 0);
x = (x == 0) ? 242 : 0;
this.addSelector(volume.getCVarName(), x, y, 0, 0);
x = (x == 0) ? H_SHIFT : 0;
if(x == 0)
y += 20;
y += BASE_SHIFT;
}
if(Volume.values().length % 2 == 0)
y -= BASE_SHIFT;
this.addSelector("snd_enabled", 0, 80, 240, 0);
this.addSelector("snd_enabled", 0, y += SEPARATOR_SHIFT, 0, 0);
this.addSelector("snd_buffer_size", 0, 100, 240, 0);
this.addSelector("snd_frame_size", 242, 100, 240, 0);
this.addSelector("snd_buffer_size", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("snd_frame_size", H_SHIFT, y, 0, 0);
this.add(new ActButton(0, 120, 482, 0, new ButtonCallback() {
this.add(new ActButton(0, y += BASE_SHIFT, BASE_WIDTH * 2 + BASE_GAP, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiSound.this.gm.restartSound(false);
}
}, "Übernehmen und Audio neu starten"));
this.addSelector("mid_velocity_func", 0, 150, 240, 0);
this.addSelector("mid_keep_notes", 242, 150, 240, 0);
this.addSelector("mid_velocity_func", 0, y += SEPARATOR_SHIFT, 0, 0);
this.addSelector("mid_keep_notes", H_SHIFT, y, 0, 0);
this.addSelector("mid_dont_fade", 0, 170, 240, 0);
this.addSelector("mid_play_unknown", 242, 170, 240, 0);
this.addSelector("mid_dont_fade", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("mid_play_unknown", H_SHIFT, y, 0, 0);
this.addSelector("mid_visualizer", 0, 190, 240, 0);
this.addSelector("mid_debug_events", 242, 190, 240, 0);
this.addSelector("mid_visualizer", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("mid_debug_events", H_SHIFT, y, 0, 0);
this.addSelector("mid_ch_16_workaround", 0, 210, 240, 0);
this.addSelector("mid_allow_switch_perc_ch", 242, 210, 240, 0);
this.addSelector("mid_ch_16_workaround", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("mid_allow_switch_perc_ch", H_SHIFT, y, 0, 0);
super.init(width, height);
}

View file

@ -11,18 +11,17 @@ import client.vars.ColorVar;
public class GuiStyle extends GuiOptions {
private static final String[] STYLE_CVARS = {
"color_button_top",
"color_button_btm",
"color_button_text",
"color_textbox_top",
"color_textbox_btm",
"color_textbox_text",
"color_border_top",
"color_label_text",
"color_button_btm",
"color_textbox_btm",
"color_border_btm",
null,
"color_label_text",
"color_button_text",
"color_textbox_text",
null,
null
};
@ -40,14 +39,18 @@ public class GuiStyle extends GuiOptions {
}
public void init(int width, int height) {
int y = 0;
for(int z = 0; z < STYLE_CVARS.length; z++) {
if(z != 0 && z % 4 == 0)
y += LABEL_SHIFT;
if(STYLE_CVARS[z] != null)
this.addColorSelector(STYLE_CVARS[z], (z / 3) * 120, (z % 3) * 34, 118, 0);
this.addColorSelector(STYLE_CVARS[z], (z % 4) * ((BASE_WIDTH - BASE_GAP) / 2 + BASE_GAP), y, (BASE_WIDTH - BASE_GAP) / 2, 0);
}
this.addSelector("gui_theme", 0, 3 * 34, 240, 0);
this.addSelector("gui_theme", 0, y += SEPARATOR_SHIFT, 0, 0);
if(this.gm.style != Style.CUSTOM)
this.add(new ActButton(242, 3 * 34, 240, 0, new ButtonCallback() {
this.add(new ActButton(H_SHIFT, y, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiStyle.this.gm.style != Style.CUSTOM) {
GuiStyle.this.gm.style.copyToCustom();
@ -58,7 +61,7 @@ public class GuiStyle extends GuiOptions {
}
}, "In 'Angepasst' kopieren"));
else
this.add(new ActButton(242, 3 * 34, 240, 0, new ButtonCallback() {
this.add(new ActButton(H_SHIFT, y, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiStyle.this.gm.style = Style.CUSTOM;
for(String cvar : STYLE_CVARS) {
@ -70,10 +73,10 @@ public class GuiStyle extends GuiOptions {
}
}, "'Angepasst' zurücksetzen"));
this.addSelector("gui_scale", 0, 3 * 34 + 20, 240, 0);
this.addSelector("gui_font", 242, 3 * 34 + 20, 240, 0);
this.addSelector("gui_scale", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("gui_font", H_SHIFT, y, 0, 0);
this.addSelector("gui_scale_items", 0, 3 * 34 + 40, 240, 0);
this.addSelector("gui_scale_items", 0, y += BASE_SHIFT, 0, 0);
super.init(width, height);
}