title: How implement javaFX into an existing game loop
body: <p>I have a very simple text-based game where a player moves around a map of room objects. I/O is the terminal.</p>
  
  <p>I want to add a UI to my project via JavaFX but I am unsure the how I should initialize the UI and the game loop together, so my UI elements can observe objects inside my game and update accordingly </p>
  
  <p>My Current code, I have omitted all but the essential code to run the main game loop </p>
  
  <pre><code>
  public static void main(String[] args) {
  
          Game game = GameLauncher.getGameLauncher().launchGameWithThemes();
          game.run();
  }
  
  
  </code></pre>
  
  <p>A game launcher is used to create a new game object. The run() method is called which enters into a loop, player input is processed and then game objects are manipulated accordingly. Example : ( <em>move room , pick up item..ect</em>) The terminal would then print ( *You move to .., you picked up *..)</p>
  
  <pre><code>public void run() {
  
          printStartUpMessage();
  
          while(true) {
  
              inputProcessor.processNextCommand(player);
  
           }
  
  
  </code></pre>
  
  <p>If I try to combine this Game Main method with the UI, The JavaFX window becomes unresponsive</p>
  
  <pre><code>@Override
      public void start(Stage primaryStage) throws Exception{
  
  
          GridPane gridPane = new GridPane();
          primaryStage.setTitle("Hello World");
          primaryStage.setScene(new Scene(gridPane, 300, 275));
          primaryStage.show();
          Game game = GameLauncher.getGameLauncher().launchGameWithThemes();
          game.run();
  
      }
  
  
  </code></pre>