mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-25 03:29:44 +01:00
SettingsMenu hat neues design
This commit is contained in:
parent
0cda6b5fa0
commit
962ecd08fa
@ -23,6 +23,7 @@ public class SettingsMenu extends Dialog {
|
||||
private final MonopolyApp app;
|
||||
private final Geometry overlayBackground;
|
||||
private final Container settingsContainer;
|
||||
private final Container backgroundContainer;
|
||||
|
||||
public SettingsMenu(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
@ -32,6 +33,11 @@ public class SettingsMenu extends Dialog {
|
||||
overlayBackground = createOverlayBackground();
|
||||
app.getGuiNode().attachChild(overlayBackground);
|
||||
|
||||
// Create the background container
|
||||
backgroundContainer = new Container();
|
||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||
app.getGuiNode().attachChild(backgroundContainer);
|
||||
|
||||
// Hauptcontainer für das Menü
|
||||
settingsContainer = new Container();
|
||||
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
||||
@ -47,23 +53,33 @@ public class SettingsMenu extends Dialog {
|
||||
effectSoundContainer.addChild(new Label("Effekt Sound", new ElementId("label")));
|
||||
effectSoundContainer.addChild(new Slider());
|
||||
effectSoundContainer.addChild(new Checkbox("Soundeffekte an")).setChecked(true);
|
||||
|
||||
effectSoundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||
// Hintergrundmusik: Slider und Checkbox
|
||||
Container backgroundMusicContainer = settingsContainer.addChild(new Container());
|
||||
backgroundMusicContainer.addChild(new Label("Hintergrund Musik", new ElementId("label")));
|
||||
backgroundMusicContainer.addChild(new Slider());
|
||||
backgroundMusicContainer.addChild(new Checkbox("Musik an")).setChecked(true);
|
||||
backgroundMusicContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||
|
||||
// Beenden-Button
|
||||
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("menu-button")));
|
||||
quitButton.setFontSize(32);
|
||||
quitButton.addClickCommands(source -> app.stop());
|
||||
|
||||
float padding = 10; // Padding around the settingsContainer for the background
|
||||
backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
|
||||
// Zentriere das Menü
|
||||
settingsContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
||||
4
|
||||
);
|
||||
|
||||
backgroundContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
||||
3
|
||||
);
|
||||
|
||||
@ -93,6 +109,7 @@ public class SettingsMenu extends Dialog {
|
||||
public void close() {
|
||||
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
|
||||
app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||
app.unblockInputs(); // Eingaben wieder aktivieren
|
||||
|
Loading…
Reference in New Issue
Block a user