| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package eu.oschl.gui;
- import eu.oschl.textadventure.Game;
- import javafx.application.Application;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.Scene;
- import javafx.stage.Stage;
- import java.io.IOException;
- import java.util.Objects;
- public class Session extends Application {
- private static Game game;
- private static ActionProcessor actionProcessor;
- public static Game getGame() {
- return game;
- }
- public static ActionProcessor getActionProcessor() {
- return actionProcessor;
- }
- public static void launchGui(Game game, String[] args)
- {
- Session.game = game;
- Session.actionProcessor = ActionProcessor.create(game);
- Application.launch(Session.class, args);
- }
- @Override
- public void start(Stage stage) throws IOException {
- FXMLLoader fxmlLoader = new FXMLLoader(Session.class.getResource("game.fxml"));
- Scene scene = new Scene(fxmlLoader.load(), 1280, 720);
- String cssPath = Objects.requireNonNull(Session.class.getResource("css/style.css")).toExternalForm();
- scene.getStylesheets().add(cssPath);
- stage.setTitle("Schmorn");
- stage.setScene(scene);
- stage.show();
- }
- }
|