mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 23:59:44 +01:00
TestWord eingefügt
This commit is contained in:
parent
2b772199b0
commit
2e0d1c059d
@ -17,6 +17,7 @@ import pp.dialog.DialogBuilder;
|
|||||||
import pp.dialog.DialogManager;
|
import pp.dialog.DialogManager;
|
||||||
import pp.graphics.Draw;
|
import pp.graphics.Draw;
|
||||||
import pp.monopoly.client.gui.SettingsMenu;
|
import pp.monopoly.client.gui.SettingsMenu;
|
||||||
|
import pp.monopoly.client.gui.TestWorld;
|
||||||
import pp.monopoly.game.client.ClientGameLogic;
|
import pp.monopoly.game.client.ClientGameLogic;
|
||||||
import pp.monopoly.game.client.MonopolyClient;
|
import pp.monopoly.game.client.MonopolyClient;
|
||||||
import pp.monopoly.game.client.ServerConnection;
|
import pp.monopoly.game.client.ServerConnection;
|
||||||
@ -117,6 +118,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setInfoText(String text) {
|
void setInfoText(String text) {
|
||||||
topText.setText(text);
|
topText.setText(text);
|
||||||
}
|
}
|
||||||
@ -157,4 +159,15 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
|||||||
.build()
|
.build()
|
||||||
.open();
|
.open();
|
||||||
}
|
}
|
||||||
|
//altes Fenster beim Start von TestWorld schließen
|
||||||
|
public void startTestWorld() {
|
||||||
|
// Beendet das MonopolyApp-Fenster
|
||||||
|
stop(false);
|
||||||
|
|
||||||
|
// Startet die TestWorld
|
||||||
|
TestWorld testWorld = new TestWorld();
|
||||||
|
testWorld.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,8 @@ public class CreateGameMenu {
|
|||||||
// "Spiel hosten"-Button
|
// "Spiel hosten"-Button
|
||||||
Button hostButton = buttonContainer.addChild(new Button("Spiel hosten"));
|
Button hostButton = buttonContainer.addChild(new Button("Spiel hosten"));
|
||||||
hostButton.setPreferredSize(new Vector3f(120, 40, 0));
|
hostButton.setPreferredSize(new Vector3f(120, 40, 0));
|
||||||
// hostButton.addClickCommands(source -> hostGame()); // Placeholder for hosting logic
|
hostButton.addClickCommands(source -> startTestWorld());
|
||||||
|
|
||||||
|
|
||||||
// "Beitreten"-Button
|
// "Beitreten"-Button
|
||||||
Button joinButton = buttonContainer.addChild(new Button("Beitreten"));
|
Button joinButton = buttonContainer.addChild(new Button("Beitreten"));
|
||||||
@ -103,4 +104,18 @@ public class CreateGameMenu {
|
|||||||
app.getGuiNode().detachChild(background); // Entfernt das Hintergrundbild
|
app.getGuiNode().detachChild(background); // Entfernt das Hintergrundbild
|
||||||
StartMenu.createStartMenu(app);
|
StartMenu.createStartMenu(app);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Link zwischen createGame und TestWorld
|
||||||
|
*/
|
||||||
|
|
||||||
|
private void startTestWorld() {
|
||||||
|
// Entfernt das Menü
|
||||||
|
app.getGuiNode().detachChild(menuContainer);
|
||||||
|
app.getGuiNode().detachChild(background);
|
||||||
|
|
||||||
|
// Startet die Testszene
|
||||||
|
TestWorld.startTestWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package pp.monopoly.client.gui;
|
||||||
|
|
||||||
|
import com.jme3.app.SimpleApplication;
|
||||||
|
import com.jme3.material.Material;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.jme3.scene.Geometry;
|
||||||
|
import com.jme3.scene.shape.Box;
|
||||||
|
import com.jme3.texture.Texture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestWorld zeigt eine einfache Szene mit einem texturierten Quadrat.
|
||||||
|
*/
|
||||||
|
public class TestWorld extends SimpleApplication {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simpleInitApp() {
|
||||||
|
// Erstelle ein Quadrat
|
||||||
|
Box box = new Box(1, 0.01f, 1); // Dünnes Quadrat für die Textur
|
||||||
|
Geometry geom = new Geometry("Box", box);
|
||||||
|
|
||||||
|
// Setze das Material mit Textur
|
||||||
|
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
|
Texture texture = assetManager.loadTexture("Pictures/board.png"); // Ersetze durch den Pfad zum gewünschten Bild
|
||||||
|
mat.setTexture("ColorMap", texture);
|
||||||
|
geom.setMaterial(mat);
|
||||||
|
|
||||||
|
// Füge das Quadrat zur Szene hinzu
|
||||||
|
rootNode.attachChild(geom);
|
||||||
|
|
||||||
|
// Setze die Kameraposition, um das Quadrat zu fokussieren
|
||||||
|
cam.setLocation(new Vector3f(0, 0, 3)); // Kamera auf der Z-Achse, nah am Quadrat
|
||||||
|
cam.lookAt(geom.getLocalTranslation(), Vector3f.UNIT_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void startTestWorld() {
|
||||||
|
TestWorld testWorldApp = new TestWorld();
|
||||||
|
testWorldApp.start();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user