示例#1
0
 @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
  @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;
  }