mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 23:59:44 +01:00
Startmenü fertig
This commit is contained in:
parent
cc47acbd3f
commit
acfeebca14
@ -23,6 +23,8 @@ import pp.monopoly.client.gui.GameMenu;
|
|||||||
*/
|
*/
|
||||||
public class StartMenu extends Dialog {
|
public class StartMenu extends Dialog {
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
|
private Container logoContainer;
|
||||||
|
private Container unibwLogoContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the Startup Menu dialog for the Monopoly application.
|
* Constructs the Startup Menu dialog for the Monopoly application.
|
||||||
@ -52,6 +54,9 @@ public class StartMenu extends Dialog {
|
|||||||
background.setLocalTranslation(0, 0, -1); // Ensure it is behind other GUI elements
|
background.setLocalTranslation(0, 0, -1); // Ensure it is behind other GUI elements
|
||||||
app.getGuiNode().attachChild(background);
|
app.getGuiNode().attachChild(background);
|
||||||
|
|
||||||
|
createMonopolyLogo(app);
|
||||||
|
createUnibwLogo(app);
|
||||||
|
|
||||||
// Center container for title and play button
|
// Center container for title and play button
|
||||||
Container centerMenu = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
Container centerMenu = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
||||||
|
|
||||||
@ -90,6 +95,68 @@ public class StartMenu extends Dialog {
|
|||||||
app.getGuiNode().attachChild(lowerRightMenu);
|
app.getGuiNode().attachChild(lowerRightMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and positions the Monopoly logo container in the center of the screen.
|
||||||
|
*/
|
||||||
|
private static void createMonopolyLogo(MonopolyApp app) {
|
||||||
|
int screenWidth = app.getContext().getSettings().getWidth();
|
||||||
|
int screenHeight = app.getContext().getSettings().getHeight();
|
||||||
|
|
||||||
|
// Load the Monopoly logo as a texture
|
||||||
|
Texture logoTexture = app.getAssetManager().loadTexture("Pictures/logo-monopoly.png");
|
||||||
|
|
||||||
|
// Create a container for the logo
|
||||||
|
Container logoContainer = new Container();
|
||||||
|
QuadBackgroundComponent logoBackground = new QuadBackgroundComponent(logoTexture);
|
||||||
|
logoContainer.setBackground(logoBackground);
|
||||||
|
|
||||||
|
// Set the size of the container to fit the logo
|
||||||
|
float logoWidth = 512; // Adjust these values based on the logo dimensions
|
||||||
|
float logoHeight = 128; // Adjust these values based on the logo dimensions
|
||||||
|
logoContainer.setPreferredSize(new Vector3f(logoWidth, logoHeight, 0));
|
||||||
|
|
||||||
|
// Position the container at the center of the screen
|
||||||
|
logoContainer.setLocalTranslation(new Vector3f(
|
||||||
|
screenWidth / 2f - logoWidth / 2f,
|
||||||
|
screenHeight / 2f + 200, // Adjust this value for vertical position
|
||||||
|
0
|
||||||
|
));
|
||||||
|
|
||||||
|
// Attach the container to the GUI node
|
||||||
|
app.getGuiNode().attachChild(logoContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and positions the Unibw logo container in the center of the screen.
|
||||||
|
*/
|
||||||
|
private static void createUnibwLogo(MonopolyApp app) {
|
||||||
|
int screenWidth = app.getContext().getSettings().getWidth();
|
||||||
|
int screenHeight = app.getContext().getSettings().getHeight();
|
||||||
|
|
||||||
|
// Load the Unibw logo as a texture
|
||||||
|
Texture unibwTexture = app.getAssetManager().loadTexture("Pictures/logo-unibw.png");
|
||||||
|
|
||||||
|
// Create a container for the Unibw logo
|
||||||
|
Container unibwContainer = new Container();
|
||||||
|
QuadBackgroundComponent unibwBackground = new QuadBackgroundComponent(unibwTexture);
|
||||||
|
unibwContainer.setBackground(unibwBackground);
|
||||||
|
|
||||||
|
// Set the size of the container to fit the Unibw logo
|
||||||
|
float unibwWidth = 512; // Adjust these values based on the logo dimensions
|
||||||
|
float unibwHeight = 128; // Adjust these values based on the logo dimensions
|
||||||
|
unibwContainer.setPreferredSize(new Vector3f(unibwWidth, unibwHeight, 0));
|
||||||
|
|
||||||
|
// Position the container slightly below the Monopoly logo
|
||||||
|
unibwContainer.setLocalTranslation(new Vector3f(
|
||||||
|
screenWidth / 2f - unibwWidth / 2f,
|
||||||
|
screenHeight / 2f + 100, // Adjust this value for vertical position
|
||||||
|
0
|
||||||
|
));
|
||||||
|
|
||||||
|
// Attach the container to the GUI node
|
||||||
|
app.getGuiNode().attachChild(unibwContainer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the game by transitioning to the CreateGameMenu.
|
* Starts the game by transitioning to the CreateGameMenu.
|
||||||
*/
|
*/
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 484 KiB |
Loading…
Reference in New Issue
Block a user