From ad6fb5e92649a9d0d9865930c14c7fa7d7191c6b Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Mon, 25 Nov 2024 04:52:34 +0100 Subject: [PATCH] added dice containers --- .../java/pp/monopoly/client/gui/Toolbar.java | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java index c4e72ea..83c7811 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java @@ -81,11 +81,41 @@ public class Toolbar extends Dialog { // Menü-Container: Ein Container für Würfel Container diceContainer = toolbarContainer.addChild(new Container()); + diceContainer.setLayout(new SpringGridLayout(Axis.X, Axis.Y)); + + // Create a horizontal container to align leftContainer and rightContainer side by side + Container horizontalContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y)); + horizontalContainer.setPreferredSize(new Vector3f(200, 150, 0)); // Adjust size as needed + + // Create the first container (leftContainer) + Container leftContainer = new Container(); + leftContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed + leftContainer.addChild(new Label("Left Container", new ElementId("label"))); + leftContainer.addChild(new Button("Button 1")); + + // Create the second container (rightContainer) + Container rightContainer = new Container(); + rightContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed + rightContainer.addChild(new Label("Right Container", new ElementId("label"))); + rightContainer.addChild(new Button("Button 2")); + + // Add leftContainer and rightContainer to the horizontal container + horizontalContainer.addChild(leftContainer); + horizontalContainer.addChild(rightContainer); + + // Add the horizontalContainer to the diceContainer (top section) + diceContainer.addChild(horizontalContainer); + + // Add the Würfeln button directly below the horizontalContainer + Button diceButton = new Button("Würfeln"); + diceButton.setPreferredSize(new Vector3f(200, 50, 0)); // Full width for Würfeln button + diceButton.addClickCommands(s -> ifTopDialog(() -> { + rollDice(); + app.getGameLogic().playSound(Sound.BUTTON); + })); + diceContainer.addChild(diceButton); + - diceContainer.setPreferredSize(new Vector3f(400, 150, 0)); - diceContainer.addChild(new Label("Wo Würfel?", new ElementId("label"))); - diceContainer.addChild(addDiceRollButton()); - diceContainer.setBackground(null); // Menü-Container: Ein Nested-Container für Handeln, Grundstücke und Zug beenden