Rearranged Input Fields and according Label Strings in Register and Login GUI (looks a lot better now)

This commit is contained in:
CrushedPixel
2015-05-03 22:49:22 +02:00
parent 5a3e3575c3
commit a0c204d29d
3 changed files with 17 additions and 10 deletions

View File

@@ -132,10 +132,12 @@ public class GuiLoginPrompt extends GuiScreen {
this.drawDefaultBackground();
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.login.title"), this.width / 2, 10, Color.WHITE.getRGB());
drawString(fontRendererObj, usernameLabel, this.width / 2 - (45+10+strwidth2), 37, Color.WHITE.getRGB());
drawString(fontRendererObj, usernameLabel, username.xPosition-10-fontRendererObj.getStringWidth(usernameLabel),
37, Color.WHITE.getRGB());
username.drawTextBox();
drawString(fontRendererObj, passwordLabel, this.width / 2 - (45+10+strwidth2), 67, Color.WHITE.getRGB());
drawString(fontRendererObj, passwordLabel, password.xPosition-10-fontRendererObj.getStringWidth(passwordLabel),
67, Color.WHITE.getRGB());
password.drawTextBox();
switch(textState) {

View File

@@ -26,6 +26,7 @@ public class GuiRegister extends GuiScreen {
private boolean initialized = false;
private int strwidth = 0;
private int totalwidth = 0;
private String[] labels = new String[]{I18n.format("replaymod.gui.username"), I18n.format("replaymod.gui.mail"), I18n.format("replaymod.gui.password"),
I18n.format("replaymod.gui.register.confirmpw")};
@@ -56,9 +57,6 @@ public class GuiRegister extends GuiScreen {
cancelButton.width = 150;
} else {
usernameInput.xPosition = mailInput.xPosition = passwordInput.xPosition = passwordConfirmation.xPosition = this.width / 2 - 45;
registerButton.xPosition = this.width / 2 - 150 - 2;
cancelButton.xPosition = this.width / 2 + 2;
}
inputFields = new ArrayList<GuiTextField>();
@@ -67,18 +65,24 @@ public class GuiRegister extends GuiScreen {
inputFields.add(passwordInput);
inputFields.add(passwordConfirmation);
buttonList.add(registerButton);
buttonList.add(cancelButton);
strwidth = Math.max(Math.max(fontRendererObj.getStringWidth(labels[0]), fontRendererObj.getStringWidth(labels[1])),
Math.max(fontRendererObj.getStringWidth(labels[2]), fontRendererObj.getStringWidth(labels[3])));
totalwidth = 145+10+strwidth;
for(GuiTextField f : inputFields)
f.xPosition = (width/2) - (totalwidth/2) + strwidth+5;
buttonList.add(registerButton);
buttonList.add(cancelButton);
initialized = true;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.register.title"), this.width / 2, 10, Color.WHITE.getRGB());
for(GuiTextField f : inputFields) {
f.drawTextBox();
@@ -86,7 +90,8 @@ public class GuiRegister extends GuiScreen {
int i = 0;
for(String label : labels) {
drawString(fontRendererObj, label, this.width / 2 - (45 + 10 + strwidth), 37+(i*30), Color.WHITE.getRGB());
drawString(fontRendererObj, label, inputFields.get(i).xPosition-10-fontRendererObj.getStringWidth(label),
37+(i*30), Color.WHITE.getRGB());
i++;
}

View File

@@ -97,7 +97,7 @@ replaymod.gui.register.confirmpw=Confirm Password
replaymod.gui.register.error.nomatch=Passwords don't match
replaymod.gui.register.error.shortusername=Username has to be at least 5 characters long
replaymod.gui.register.error.shortpw=Password has to be at least 5 characters long
replaymod.gui.register.error.invalidmail=Invalid eMail Address
replaymod.gui.register.error.invalidmail=Invalid e-Mail Address
#Replay Viewer GUI