Commit 0428bdff authored by Thomas's avatar Thomas
Browse files

Removed static reference call of GameCore in controllers

parent 32e8b62b
......@@ -22,7 +22,7 @@ public class ClientApp extends Application {
private static ComCoreClient comCoreClient;
private static DataCoreClient dataCoreClient;
public static MainCore mainCore;
public static GameCore gameCore;
private static GameCore gameCore;
public static final String APPLICATION_NAME = "Othello";
public static final int APPLICATION_WIDTH = 889;
public static final int APPLICATION_HEIGHT = 500;
......
......@@ -67,8 +67,10 @@ public class GameCore {
public void initializeFxStage(String fxmlResource, Stage stage) throws IOException {
fxStage = stage;
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(fxmlResource));
fxmlLoader.setControllerFactory(c -> {
return controller;
});
BorderPane root = (BorderPane) fxmlLoader.load();
Scene scene = new Scene(root, 1200, 800);
scene.getStylesheets().add("view/game.css");
......
......@@ -10,7 +10,6 @@ import javafx.scene.control.TextArea;
import javafx.scene.control.Tooltip;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import main.java.client.ClientApp;
import main.java.client.game.GameCore;
import main.java.common.dataModel.Message;
......@@ -75,15 +74,6 @@ public class MainGameController {
* Method called after the display of the game Java FX scene
*/
public void initialize() {
/*
* TODO: TEMPORARY FIX
*
* Another MainGameController is automatically created by JavaFX once the stage
* has been set using the related ihm game fxml file. Because of that, the
* current core is no longer set.
*/
setCore(ClientApp.gameCore);
// Remove access to the chat panel if the game configuration says so
if (!gameCore.getDataToGame().isChatAuthorized()) {
sideRightTabPane.getTabs().get(1).setDisable(true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment