Beispiel #1
0
  @Override
  public void start(Stage s) {
    myGame = new Game();
    s.setTitle(myGame.getTitle());

    Scene scene = myGame.init(WIDTH, HEIGHT);
    s.setScene(scene);

    s.show();

    KeyFrame frame =
        new KeyFrame(Duration.millis(MILLISECOND_DELAY), e -> myGame.step(SECOND_DELAY));
    Timeline animation = new Timeline();
    animation.setCycleCount(Timeline.INDEFINITE);
    animation.getKeyFrames().add(frame);
    animation.play();

    s.setResizable(false);
  }
Beispiel #2
0
  /**
   * Most games windows cannot be resized, so this method isn't used much. Note, this only changes
   * the size of the screen, it does not change the sizes of the {@link View}s.
   *
   * @param width The new width of the screen in pixels.
   * @param height The new height of the screen in pixels.
   * @priority 3
   */
  public static void resizeScreen(int width, int height) {
    Game game = currentGame;

    setScreenMode(game.getTitle(), game.resources, width, height, game.isResizable());
    lastWindowResizeTime = new Date().getTime();
  }
Beispiel #3
0
 private static void setScreenMode(Game game) {
   setScreenMode(
       game.getTitle(), game.resources, game.getWidth(), game.getHeight(), game.isResizable());
 }
 /** @see org.newdawn.slick.Game#getTitle() */
 public String getTitle() {
   return held.getTitle();
 }