コード例 #1
0
ファイル: PlayerInput.java プロジェクト: Oger-Lord/JPenguin
  public void onMouseButtonEvent(MouseButtonEvent event) {
    if (event.isReleased()) {
      return;
    }
    if (mouseStatus == null) {
      return;
    }
    PlayerControler p = game.getPlayerControler();

    if (event.getButtonIndex() == 0) // links
    {
      if (mouseStatus.getModel() == null) {
        p.mouseClick(0, mouseStatus.getX(), mouseStatus.getY());
      } else {
        p.mouseClick(0, (Unit) mouseStatus.getModel().getParent());
      }
    } else if (event.getButtonIndex() == 1) // rechts
    {
      if (mouseStatus.getModel() == null) {
        p.mouseClick(1, mouseStatus.getX(), mouseStatus.getY());
      } else {
        p.mouseClick(1, (Unit) mouseStatus.getModel().getParent());
      }
    } else { // mitte

    }
  }
コード例 #2
0
ファイル: PlayerInput.java プロジェクト: Oger-Lord/JPenguin
  public void beginInput() {
    mouseStatus = gameApp.getMouseCollision();
    PlayerControler p = game.getPlayerControler();

    if (mouseStatus != null) {
      if (mouseStatus.getModel() != null) {
        p.mouseHover((Unit) mouseStatus.getModel().getParent());
      } else {
        p.mouseHover(null);
      }
    } else {
      p.mouseHover(null);
    }
  }