Пример #1
0
 @Override
 public void enter(GameContainer gc, StateBasedGame sbg) throws SlickException {
   AllowClick = false;
   textHandle.updateFontSize();
   super.enter(gc, sbg);
   backgroundColor = new Color(0, 0, 0, Properties.BackgroundTransparency);
 }
Пример #2
0
  @Override
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    for (int i = 0; i < tile_map.length; i++) {
      for (int j = tile_map[i].length - 1; j >= 0; j--) {
        int x = (int) (((j * tile_width / 2) + (i * tile_width / 2)) * Properties.ResolutionScale);
        int y =
            (int)
                (((i * tile_height / 2) - (j * tile_height / 2) + 360)
                    * Properties.ResolutionScale);
        getSpriteImage(tile_map[i][j]).draw(x, y, Properties.ResolutionScale);
      }
    }

    for (int i = 0; i < object_map.length; i++) {
      for (int j = object_map[i].length - 1; j >= 0; j--) {
        int x = (int) (((j * tile_width / 2) + (i * tile_width / 2)) * Properties.ResolutionScale);
        int y =
            (int)
                (((i * tile_height / 2) - (j * tile_height / 2) + 360)
                    * Properties.ResolutionScale);
        getSpriteImage(object_map[i][j]).draw(x, y, Properties.ResolutionScale);
      }
    }

    if (updatePreview) {
      g.copyArea(imagePreview, 0, 0);
      updatePreview = false;
    }
    if (!HideOverlay) {
      g.setColor(backgroundColor);
      g.fillRect(0, 0, 1280 * Properties.ResolutionScale, 720 * Properties.ResolutionScale);
      textHandle.drawStrings(sceneDescription);
    }
  }
Пример #3
0
  @Override
  public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {

    if (KeyPressed || KeyHeld) {
      if (Key == Input.KEY_TAB) {
        HideOverlay = true;
      } else {
        HideOverlay = false;
      }
    }

    if (KeyPressed) {
      switch (Key) {
        case (Input.KEY_ESCAPE):
          ((OptionsView) sbg.getState(Constants.Options)).setBackgroundImage(imagePreview);
          ((BaseView) sbg.getState(Constants.Options)).setPreviousState(Constants.Isometric);
          sbg.enterState(Constants.Options);
          break;
      }
    } else {
      HideOverlay = false;
    }

    if (Mouse.isButtonDown(0) && AllowClick) {
      if (textHandle.textClicked(Mouse.getX(), gc.getHeight() - Mouse.getY())) {
        ((BaseView) sbg.getState(Constants.Book)).PreviousState = Constants.Isometric;
        sbg.enterState(Constants.Book);
      }
      AllowClick = false;
    }

    if (!AllowClick) {
      if (!Mouse.isButtonDown(0)) {
        AllowClick = true;
      }
    }
  }
Пример #4
0
 /**
  * Add listener
  *
  * @param listener a listener to add
  */
 public void addLineListener(LineHandlerListener listener) {
   super.addListener(listener);
   myLineListeners.addListener(listener);
 }