Cleaner code
This commit is contained in:
@ -4,26 +4,43 @@
|
||||
package school_project;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.stage.Screen;
|
||||
import javafx.stage.Stage;
|
||||
import school_project.Parsers.FileParserFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class Controller extends Application {
|
||||
private Stage stage;
|
||||
Parent root;
|
||||
public static Vec2 screen_size;
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
primaryStage.setTitle("test");
|
||||
Button btn = new Button("test");
|
||||
btn.setOnAction(event -> System.out.println("hey"));
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
stage = primaryStage;
|
||||
screen_size = new Vec2(
|
||||
(int) Screen.getPrimary().getBounds().getWidth(),
|
||||
(int) Screen.getPrimary().getBounds().getHeight()
|
||||
);
|
||||
|
||||
Group root = new Group();
|
||||
root.getChildren().add(btn);
|
||||
stage.setTitle("ROAD TO MASTER YOU");
|
||||
|
||||
Scene scene = new Scene(root, 300,300);
|
||||
primaryStage.setScene(scene);
|
||||
// Full Screen mode
|
||||
stage.setFullScreen(true);
|
||||
stage.setFullScreenExitHint("");
|
||||
primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
|
||||
|
||||
primaryStage.show();
|
||||
root = new GameUI(FileParserFactory.loadMapFromFile(new File(getClass().getResource("level11.level").getFile())));
|
||||
|
||||
Scene scene = new Scene(root, screen_size.x, screen_size.y);
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
Reference in New Issue
Block a user