public class GuiMainMenu extends GuiScreen {
public static int counter = 1;
private final long initTime = System.currentTimeMillis();
public static int bg = 0;
private GLSLUtil backgroundShader;
float offset;
private List<String> buttons = new ArrayList();
private String selectedButton = "";
private GuiWorldSelection guiWorldSelection;
private GuiMultiplayer guiMultiplayer;
private GuiOptions guiOptions;
public GuiMainMenu() {
}
public void initGui() {
try {
this.backgroundShader = new GLSLUtil("/assets/noise.fsh");
}
catch (IOException var2) {
throw new IllegalStateException("backgroundShader - error", var2);
}
this.buttons.clear();
this.buttons.addAll(Arrays.asList("singleplayer", "multiplayer", "settings", "altmanager"));
}
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
ScaledResolution sr = new ScaledResolution(this.mc);
// shader
this.backgroundShader.useShader(sr.getScaledWidth(), sr.getScaledHeight(), mouseX, mouseY, (float)(System.currentTimeMillis() - this.initTime) / 1500.0f);
GL11.glBegin((int)7);
GL11.glVertex2f((float)-1.0f, (float)-1.0f);
GL11.glVertex2f((float)-1.0f, (float)1.0f);
GL11.glVertex2f((float)1.0f, (float)1.0f);
GL11.glVertex2f((float)1.0f, (float)-1.0f);
GL11.glEnd();
GL20.glUseProgram((int)0);
GlStateManager.disableCull();
GlStateManager.pushMatrix();
RoundedUtil.drawRound((float)(sr.getScaledWidth() / 2 - 70), (float)(sr.getScaledHeight() / 2 - 32.5), 140.0F, 110.0F, 5.0F, new Color(0, 0, 0, 110));
this.offset = 0.0F;
for(Iterator var5 = this.buttons.iterator(); var5.hasNext(); this.offset += 20.0F) {
String string = (String)var5.next();
Fonts.REG16.drawCenteredString(string, (float)(sr.getScaledWidth() / 2), (float)(sr.getScaledHeight() / 2 - 40 + 34 + 5) + this.offset, new Color(255,255,255,150).getRGB());
RoundedUtil.drawRound((float)(sr.getScaledWidth() / 2 - 55), (float)(sr.getScaledHeight() / 2 - 40 + 34) + this.offset, 110.0F, 15.0F, 3.0F, HoverUtil.isHovered(mouseX, mouseY, (double)(sr.getScaledWidth() / 2 - 55), (double)((float)(sr.getScaledHeight() / 2 - 40 + 34) + this.offset), 110.0, 15.0) ? new Color(255, 255, 255, 18) : new Color(255, 255, 255, 10));
}
GlStateManager.popMatrix();
super.drawScreen(mouseX, mouseY, partialTicks);
}
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
ScaledResolution sr = new ScaledResolution(this.mc);
this.offset = 0.0F;
for(Iterator var5 = this.buttons.iterator(); var5.hasNext(); this.offset += 20.0F) {
String string = (String)var5.next();
if (HoverUtil.isHovered(mouseX, mouseY, (double)(sr.getScaledWidth() / 2 - 55), (double)((float)(sr.getScaledHeight() / 2 - 40 + 34) + this.offset), 110.0, 15.0)) {
this.selectedButton = string;
}
}
switch (this.selectedButton) {
case "singleplayer":
this.guiWorldSelection = new GuiWorldSelection(this.guiWorldSelection);
this.mc.displayGuiScreen(this.guiWorldSelection);
this.selectedButton = "";
break;
case "multiplayer":
this.guiMultiplayer = new GuiMultiplayer(this.guiMultiplayer);
this.mc.displayGuiScreen(this.guiMultiplayer);
this.selectedButton = "";
break;
case "settings":
this.guiOptions = new GuiOptions(this.guiOptions, this.mc.gameSettings);
this.mc.displayGuiScreen(this.guiOptions);
this.selectedButton = "";
break;
case "altmanager":
GuiScreen altManager = new AltManager();
this.mc.displayGuiScreen(altManager);
this.selectedButton = "";
}
}
}