misc fixes

This commit is contained in:
Sen 2025-03-17 02:11:09 +01:00
parent 2783aaa2ce
commit 887401b0b8
3 changed files with 61 additions and 11 deletions

View file

@ -4,11 +4,13 @@ import game.color.TextColor;
import game.gui.element.ActButton;
import game.gui.element.Label;
import game.gui.element.Textbox;
import game.gui.element.ActButton.Mode;
import game.gui.element.Textbox.Action;
import game.gui.world.GuiWorlds;
import game.init.Config;
import game.renderer.Drawing;
import game.rng.Random;
import game.util.ExtMath;
import game.util.Splashes;
import game.util.Timing;
import game.window.Keysym;
@ -27,8 +29,9 @@ public class GuiMenu extends Gui {
}
private final Random rand = new Random();
private Label splashLabel;
private ActButton infoButton;
private int ticks;
private int hacked;
@ -48,9 +51,48 @@ public class GuiMenu extends Gui {
this.ticks = 0;
this.hacked = 0;
this.resetAnimation();
this.add(new ActButton(0, 0, 400, 24, (Gui)GuiWorlds.INSTANCE, "Einzelspieler"));
this.add(new ActButton(0, 28, 400, 24, (Gui)GuiConnect.INSTANCE, "Mehrspieler"));
this.add(new ActButton(0, 56, 400, 24, GuiInfo.INSTANCE, "Info / Über / Mitwirkende"));
this.add(new ActButton(0, 0, 400, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) {
if(GuiMenu.this.hacked == 9) {
GuiMenu.this.hacked++;
GuiMenu.this.splashLabel.setText(TextColor.VIOLET + "Hax!");
}
else {
GuiMenu.this.gm.displayGuiScreen(GuiWorlds.INSTANCE);
}
}
}, "Einzelspieler"));
this.add(new ActButton(0, 28, 400, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) {
if(GuiMenu.this.hacked == 8)
GuiMenu.this.hacked++;
else
GuiMenu.this.gm.displayGuiScreen(GuiConnect.INSTANCE);
}
}, "Mehrspieler"));
this.infoButton = this.add(new ActButton(0, 56, 400, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) {
GuiMenu.this.gm.displayGuiScreen(GuiMenu.this.hacked == 10 ? GuiInfo.HAX : GuiInfo.INSTANCE);
}
}, "Info / Über / Mitwirkende") {
public void drawHover() {
if(GuiMenu.this.hacked == 10) {
Drawing.drawRectColor(this.pos_x, this.pos_y, this.size_x, this.size_y, (this.gm.style.hover & 0xff000000) | 0x7f00ff);
GuiMenu.this.rand.setSeed(((long)this.gm.mouse_x * 7652657L) ^ ((long)this.gm.mouse_y * 87262826276L));
int width = Drawing.getWidth("Hax!");
for(int z = 0; z < 64; z++) {
Drawing.drawText("Hax!", GuiMenu.this.rand.zrange(Math.max(1, this.gm.fb_x - width)) +
(int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + (float)Timing.tick_fraction) / 100.0f * (float)Math.PI * 2.0f) * 16.0f),
GuiMenu.this.rand.zrange(Math.max(1, this.gm.fb_y - Font.YGLYPH)) +
(int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + (float)Timing.tick_fraction) / 100.0f * (float)Math.PI * 2.0f) * 16.0f),
0xff0000ff | (GuiMenu.this.rand.zrange(256) << 16));
}
}
else {
super.drawHover();
}
}
});
this.add(new ActButton(0, 102, 196, 24, GuiOptions.getPage(), "Einstellungen"));
this.add(new ActButton(204, 102, 196, 24, new ActButton.Callback() {
public void use(ActButton elem, ActButton.Mode action) {