mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-25 05:49: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 MonopolyApp app;
|
||||||
private final Geometry overlayBackground;
|
private final Geometry overlayBackground;
|
||||||
private final Container settingsContainer;
|
private final Container settingsContainer;
|
||||||
|
private final Container backgroundContainer;
|
||||||
|
|
||||||
public SettingsMenu(MonopolyApp app) {
|
public SettingsMenu(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
@ -32,6 +33,11 @@ public class SettingsMenu extends Dialog {
|
|||||||
overlayBackground = createOverlayBackground();
|
overlayBackground = createOverlayBackground();
|
||||||
app.getGuiNode().attachChild(overlayBackground);
|
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ü
|
// Hauptcontainer für das Menü
|
||||||
settingsContainer = new Container();
|
settingsContainer = new Container();
|
||||||
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
||||||
@ -47,24 +53,34 @@ public class SettingsMenu extends Dialog {
|
|||||||
effectSoundContainer.addChild(new Label("Effekt Sound", new ElementId("label")));
|
effectSoundContainer.addChild(new Label("Effekt Sound", new ElementId("label")));
|
||||||
effectSoundContainer.addChild(new Slider());
|
effectSoundContainer.addChild(new Slider());
|
||||||
effectSoundContainer.addChild(new Checkbox("Soundeffekte an")).setChecked(true);
|
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
|
// Hintergrundmusik: Slider und Checkbox
|
||||||
Container backgroundMusicContainer = settingsContainer.addChild(new Container());
|
Container backgroundMusicContainer = settingsContainer.addChild(new Container());
|
||||||
backgroundMusicContainer.addChild(new Label("Hintergrund Musik", new ElementId("label")));
|
backgroundMusicContainer.addChild(new Label("Hintergrund Musik", new ElementId("label")));
|
||||||
backgroundMusicContainer.addChild(new Slider());
|
backgroundMusicContainer.addChild(new Slider());
|
||||||
backgroundMusicContainer.addChild(new Checkbox("Musik an")).setChecked(true);
|
backgroundMusicContainer.addChild(new Checkbox("Musik an")).setChecked(true);
|
||||||
|
backgroundMusicContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
// Beenden-Button
|
// Beenden-Button
|
||||||
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("menu-button")));
|
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("menu-button")));
|
||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
quitButton.addClickCommands(source -> app.stop());
|
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ü
|
// Zentriere das Menü
|
||||||
settingsContainer.setLocalTranslation(
|
settingsContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
||||||
3
|
4
|
||||||
|
);
|
||||||
|
|
||||||
|
backgroundContainer.setLocalTranslation(
|
||||||
|
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
||||||
|
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
||||||
|
3
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(settingsContainer);
|
app.getGuiNode().attachChild(settingsContainer);
|
||||||
@ -93,6 +109,7 @@ public class SettingsMenu extends Dialog {
|
|||||||
public void close() {
|
public void close() {
|
||||||
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
|
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
|
||||||
app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
|
app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
|
||||||
|
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||||
app.unblockInputs(); // Eingaben wieder aktivieren
|
app.unblockInputs(); // Eingaben wieder aktivieren
|
||||||
|
Loading…
Reference in New Issue
Block a user