more menus
Some checks failed
Linux arm64 / Build (push) Failing after 14m21s

This commit is contained in:
2025-01-23 15:50:10 +01:00
parent 7ab1173fb3
commit b05351bc20
6 changed files with 117 additions and 8 deletions

View File

@@ -1,18 +1,56 @@
package gui.menu;
import imgui.ImGui;
import imgui.ImVec2;
import imgui.type.ImInt;
import imgui.type.ImString;
public class MultiMenu extends BaseView {
private final ImInt port = new ImInt(25565);
private final ImString address = new ImString("localhost");
public MultiMenu(StateMachine stateMachine) {
super(stateMachine);
}
private void renderCreate() {
ImVec2 displaySize = ImGui.getIO().getDisplaySize();
ImGui.beginChild("##CreateGame", new ImVec2(displaySize.x / 2.0f, displaySize.y * 8.0f / 9.0f));
ImGui.inputInt("Port", port);
if (ImGui.button("Créer")) {
// TODO: create game
}
ImGui.endChild();
}
private void renderJoin() {
ImVec2 displaySize = ImGui.getIO().getDisplaySize();
ImGui.beginChild("##JoinGame", new ImVec2(displaySize.x / 2.0f, displaySize.y * 8.0f / 9.0f));
ImGui.inputText("Adresse", address);
ImGui.inputInt("Port", port);
if (ImGui.button("Rejoindre")) {
// TODO: join game
}
ImGui.endChild();
}
@Override
public void render() {
// TODO Auto-generated method stub
ImGui.text("Multi");
renderReturnButton();
renderCreate();
ImGui.sameLine();
renderJoin();
ImVec2 displaySize = ImGui.getIO().getDisplaySize();
ImVec2 buttonSize = new ImVec2(500, 70.0f);
float centerX = displaySize.x / 2.0f - buttonSize.x / 2.0f;
ImGui.setCursorPosX(centerX);
if (ImGui.button("Retour", buttonSize)) {
closeMenu();
}
}
}