Example #1
0
  public static void startGame() {

    MainFrame mainFrame = init();
    mainFrame.setCrossplatformSize();
    while (true) {
      isNewGameButtonPressed = false;
      while (gameState.hasGame()) {
        gameState.moveFigureDown();
        try {
          Thread.sleep(gameState.getDelay());
          while (gameState.isPaused()) {
            Thread.sleep(300);
          }
        } catch (InterruptedException e) {
          // do nothing
        }
      }
      while (!isNewGameButtonPressed) {
        try {
          Thread.sleep(500);
        } catch (InterruptedException e) {
          // do nothing
        }
      }
      mainFrame.clearAndRestart();
    }
  }