connect menu cow working

This commit is contained in:
Johannes Schmelz 2024-11-24 20:52:29 +01:00
parent 75d3bef5c8
commit 8b0ef97a82
2 changed files with 11 additions and 5 deletions

View File

@ -219,7 +219,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
setupInput(); setupInput();
setupStates(); setupStates();
setupGui(); setupGui();
// new StartMenu(this).open(); new StartMenu(this).open();
} }
/** /**
@ -319,6 +319,13 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
return draw; return draw;
} }
/**
* Tries to connect
*/
public void connect() {
serverConnection.connect();
}
/** /**
* Handles a request to close the application. * Handles a request to close the application.
* If the request is initiated by pressing ESC, this parameter is true. * If the request is initiated by pressing ESC, this parameter is true.

View File

@ -54,7 +54,7 @@ public class StartMenu extends Dialog {
startButton.setFontSize(40); // Set the font size for the button text startButton.setFontSize(40); // Set the font size for the button text
startButton.setTextHAlignment(HAlignment.Center); // Center the text horizontally startButton.setTextHAlignment(HAlignment.Center); // Center the text horizontally
startButton.addClickCommands(); startButton.addClickCommands(s -> app.connect());
centerMenu.addChild(startButton); centerMenu.addChild(startButton);
// Position the center container in the middle of the screen // Position the center container in the middle of the screen
@ -79,7 +79,7 @@ public class StartMenu extends Dialog {
Button settingsButton = new Button("Einstellungen"); Button settingsButton = new Button("Einstellungen");
settingsButton.setPreferredSize(new Vector3f(130, 40, 0)); // Increase button size slightly (width, height) settingsButton.setPreferredSize(new Vector3f(130, 40, 0)); // Increase button size slightly (width, height)
settingsButton.setFontSize(18); // Increase the font size for the text settingsButton.setFontSize(18); // Increase the font size for the text
settingsButton.addClickCommands(source -> ifTopDialog(this::close)); settingsButton.addClickCommands(source -> new SettingsMenu(app).open());
lowerRightMenu.addChild(settingsButton); lowerRightMenu.addChild(settingsButton);
app.getGuiNode().attachChild(lowerRightMenu); app.getGuiNode().attachChild(lowerRightMenu);
@ -133,7 +133,6 @@ public class StartMenu extends Dialog {
@Override @Override
public void escape() { public void escape() {
// TODO Auto-generated method stub close();
super.escape();
} }
} }