From 853c32a5b839c2a121f30c47d6cdfb2b4afcabd4 Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Mon, 25 Nov 2024 02:11:05 +0100 Subject: [PATCH] fixed Buttons --- .../monopoly/client/gui/CreateGameMenu.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java index cb73d3c..ce0c4db 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java @@ -12,7 +12,11 @@ import java.lang.System.Logger.Level; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; +import com.jme3.material.Material; import com.jme3.math.Vector3f; +import com.jme3.scene.Geometry; +import com.jme3.scene.shape.Quad; +import com.jme3.texture.Texture; import com.simsilica.lemur.Button; import com.simsilica.lemur.Container; import com.simsilica.lemur.Label; @@ -60,6 +64,21 @@ public class CreateGameMenu extends Dialog { port.setSingleLine(true); final MonopolyApp app = network.getApp(); + + int screenWidth = app.getContext().getSettings().getWidth(); + int screenHeight = app.getContext().getSettings().getHeight(); + + // Set up the background image + Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png"); + Quad quad = new Quad(screenWidth, screenHeight); + Geometry background = new Geometry("Background", quad); + Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); + backgroundMaterial.setTexture("ColorMap", backgroundImage); + background.setMaterial(backgroundMaterial); + background.setLocalTranslation(0, 0, -1); // Ensure it is behind other GUI elements + app.getGuiNode().attachChild(background); + + final Container input = new Container(new SpringGridLayout()); input.addChild(new Label(lookup("host.name") + ": ")); input.addChild(host, 1); @@ -72,6 +91,7 @@ public class CreateGameMenu extends Dialog { cancelButton.addClickCommands(source -> close()); addChild(cancelButton); cancelButton.addClickCommands(s -> ifTopDialog(() -> { + this.close(); new StartMenu(app); app.getGameLogic().playSound(Sound.BUTTON); })); @@ -86,7 +106,7 @@ public class CreateGameMenu extends Dialog { joinButton.setPreferredSize(new Vector3f(120, 40, 0)); addChild(joinButton); joinButton.addClickCommands(s -> ifTopDialog(() -> { - app.connect(); + connect(); app.getGameLogic().playSound(Sound.BUTTON); })); }