示例#1
0
  /**
   * Centers the screen at the given position.
   *
   * @param pos position to center.
   */
  public void center(final Pos pos) {
    int newOffsetX = pos.getX() - screenDefinition.getWidthGameFrame() / 2;
    int newOffsetY = pos.getY() - screenDefinition.getHeight() / 2;
    setOffset(newOffsetX - offsetX, newOffsetY - offsetY);

    Pos selectedPos = getSelectedPosition();
    int newSelector1PosX = pos.getX() - selectedPos.getX();
    int newSelector1PosY = pos.getY() - selectedPos.getY();
    setSelectedPos(newSelector1PosX, newSelector1PosY);
  }
示例#2
0
 /**
  * returns true, if the given position is the selected position.
  *
  * @param pos Position
  * @return true, if the given position is the selected position.
  */
 public boolean isSelectedPosition(final Pos pos) {
   return offsetX + selectorPosX == pos.getX() && offsetY + selectorPosY == pos.getY();
 }