コード例 #1
0
ファイル: ActionArea2D.java プロジェクト: sabarjp/VictusLudus
 @Override
 public void onMouseMove(final MouseEvent mouseEvent) {
   if (!this.isDisabled() && this.isVisible()) {
     if (this.isInside(mouseEvent.getX(), mouseEvent.getY())) {
       if (!this.isHoveredOn) {
         VictusLudusGame.engine.eventHandler.signal(new HoverEvent(this, true));
       }
     } else {
       if (this.isHoveredOn) {
         VictusLudusGame.engine.eventHandler.signal(new HoverEvent(this, false));
       }
     }
   }
 }
コード例 #2
0
ファイル: ActionArea2D.java プロジェクト: sabarjp/VictusLudus
  @Override
  public boolean onMouseClick(final MouseEvent mouseEvent) {
    if (!this.isDisabled() && this.isVisible()) {
      if (mouseEvent.getButton() == Buttons.LEFT) {
        if (mouseEvent.isButtonPressed()) {
          if (this.isInside(mouseEvent.getX(), mouseEvent.getY())) {
            this.isDepressed = true;
            return true;
          }
        } else {
          if (this.isInside(mouseEvent.getX(), mouseEvent.getY())) {
            if (this.isDepressed) {
              this.isDepressed = false;
              this.mouseClickAct.act();
              return true;
            }
          } else {
            this.isDepressed = false;
            return false;
          }
        }
      }
    }

    return false;
  }