From f33c673a05d36a98537a1fb37d690e26fba41558 Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Fri, 22 Nov 2024 07:15:25 +0100 Subject: [PATCH] =?UTF-8?q?lobby=20f=C3=BCr=20feinschliff=20vorbereitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pp/monopoly/client/gui/LobbyMenu.java | 60 +++++++++++++++++-- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java index 2723f35..2912fb2 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java @@ -1,6 +1,7 @@ package pp.monopoly.client.gui; import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Quad; @@ -8,9 +9,14 @@ import com.jme3.texture.Texture; import com.simsilica.lemur.Axis; import com.simsilica.lemur.Button; import com.simsilica.lemur.Container; +import com.simsilica.lemur.Insets3f; import com.simsilica.lemur.Label; +import com.simsilica.lemur.Selector; +import com.simsilica.lemur.TextField; +import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.component.SpringGridLayout; +import com.simsilica.lemur.style.ElementId; import pp.monopoly.client.MonopolyApp; public class LobbyMenu { @@ -28,19 +34,63 @@ public class LobbyMenu { // Hintergrundbild laden und hinzufügen addBackgroundImage(); - // Hauptcontainer für das Menü - menuContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X)); - menuContainer.setPreferredSize(new Vector3f(600, 400, 0)); // Feste Größe des Containers + QuadBackgroundComponent translucentWhiteBackground = + new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f)); - // Titel - Label title = menuContainer.addChild(new Label("Lobby")); + menuContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X)); + menuContainer.setPreferredSize(new Vector3f(1000, 600, 0)); // Fixed size of the container + menuContainer.setBackground(translucentWhiteBackground); + + // Create a smaller horizontal container for the label, input field, and spacers + Container horizontalContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y))); + horizontalContainer.setPreferredSize(new Vector3f(600, 50, 0)); // Adjust container size + horizontalContainer.setBackground(null); + + Label title = horizontalContainer.addChild(new Label("Startkapital:",new ElementId("label-Bold"))); title.setFontSize(48); + // Add a spacer between the title and the input field + Label spacerBeforeInput = horizontalContainer.addChild(new Label("")); // Invisible spacer + spacerBeforeInput.setPreferredSize(new Vector3f(20, 1, 0)); // Width of the spacer + + // Add an input field (TextField) + TextField startingCapital = horizontalContainer.addChild(new TextField("")); + startingCapital.setPreferredWidth(100); // Set the width of the input field + startingCapital.setPreferredSize(new Vector3f(150, 50, 0)); + startingCapital.setInsets(new Insets3f(5, 10, 5, 10)); // Add padding around the text inside the field + + // Add a spacer after the input field + Label spacerAfterInput = horizontalContainer.addChild(new Label("")); // Invisible spacer + spacerAfterInput.setPreferredSize(new Vector3f(20, 1, 0)); // Width of the spacer + + menuContainer.setLocalTranslation( + (app.getCamera().getWidth() - menuContainer.getPreferredSize().x) / 2, + (app.getCamera().getHeight() + menuContainer.getPreferredSize().y) / 2, + 1 + ); + app.getGuiNode().attachChild(menuContainer); + // Spielerstatus anzeigen Container playerListContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X))); playerListContainer.addChild(new Label("Spieler in der Lobby:")); + playerListContainer.setBackground(null); Label playersLabel = playerListContainer.addChild(new Label("Noch keine Spieler verbunden.")); // Beispieltext + // Dropdown menu for game options + Selector dropdown = new Selector<>(); + for (int i = 1; i <= 10; i++) { // Generate 10 options + dropdown.getModel().add("Option " + i); + } + + menuContainer.addChild(new Label("Game Options:")); // Add a label for clarity + menuContainer.addChild(dropdown); + + // Adjust the dropdown's popup container size if necessary + Vector3f dimens = menuContainer.getPreferredSize(); + Vector3f dimens2 = dropdown.getPopupContainer().getPreferredSize(); + dimens2.setX(dimens.getX()); + dropdown.getPopupContainer().setPreferredSize(dimens2); + // Buttons Container buttonContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y))); buttonContainer.setPreferredSize(new Vector3f(400, 50, 0));