fdai7736
12 months ago
9 changed files with 89 additions and 20 deletions
-
32src/main/java/de/hsfulda/onses/App.java
-
27src/main/java/de/hsfulda/onses/controllers/AppController.java
-
10src/main/java/de/hsfulda/onses/controllers/CardController.java
-
4src/main/java/de/hsfulda/onses/controllers/Controller.java
-
10src/main/java/de/hsfulda/onses/controllers/GameController.java
-
11src/main/java/de/hsfulda/onses/controllers/PlayerController.java
-
6src/main/resources/de/hsfulda/onses/views/app.fxml
-
5src/main/resources/de/hsfulda/onses/views/game.fxml
-
4src/test/java/de/hsfulda/onses/GuiTest.java
@ -1,18 +1,44 @@ |
|||
package de.hsfulda.onses; |
|||
|
|||
import de.hsfulda.onses.controllers.AppController; |
|||
import de.hsfulda.onses.controllers.Controller; |
|||
import de.hsfulda.onses.services.GameService; |
|||
import javafx.application.Application; |
|||
import javafx.scene.Parent; |
|||
import javafx.scene.Scene; |
|||
import javafx.scene.control.Label; |
|||
import javafx.stage.Stage; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
public class App extends Application { |
|||
|
|||
private Stage stage; |
|||
private Controller controller; |
|||
@Override |
|||
public void start(Stage stage) throws Exception { |
|||
final AppController appController = new AppController(new GameService(), stage); |
|||
public void start(Stage stage) { |
|||
this.stage = stage; |
|||
final AppController appController = new AppController(this, new GameService()); |
|||
|
|||
stage.setTitle("Onses - Uno"); |
|||
stage.setScene(new Scene(appController.render())); |
|||
stage.setScene(new Scene(new Label("Loading..."))); |
|||
|
|||
show(appController); |
|||
stage.show(); |
|||
} |
|||
|
|||
public void show(Controller controller) { |
|||
try { |
|||
final Parent parent = controller.render(); |
|||
stage.getScene().setRoot(parent); |
|||
} catch (IOException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
|
|||
if(this.controller != null) { |
|||
this.controller.destroy(); |
|||
} |
|||
this.controller = controller; |
|||
stage.setTitle(controller.getTitle()); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue