Example #1
0
  @Override
  public void handleInput(Matrix parentTransform, IInput input) {
    super.handleInput(parentTransform, input);

    Vec2 pointerPos = input.getPointerPos(parentTransform);

    boolean enabled = isEnabled() && isVisible(alphaEnableThreshold);
    boolean mouseContains = enabled && contains(pointerPos.x, pointerPos.y);

    if (enabled) {
      model.setRollover(mouseContains);
      if (mouseContains && input.consumePress(VKey.MOUSE_LEFT)) {
        model.setPressed(true);
      }
      if (!input.isPressed(VKey.MOUSE_LEFT, true)) {
        model.setPressed(false);
      }
    } else {
      model.setRollover(false);
      model.setPressed(false);
    }

    if (clickHandler != null && model.consumePress()) {
      eventDispatcher.addEvent(clickHandler);
    }
  }
Example #2
0
 @Override
 public boolean isToggle() {
   return model.isToggle();
 }
Example #3
0
 @Override
 public void setToggle(boolean t) {
   model.setToggle(t);
 }
Example #4
0
 @Override
 public boolean isSelected() {
   return model.isSelected();
 }
Example #5
0
 @Override
 public void setSelected(boolean s) {
   model.setSelected(s);
 }
Example #6
0
 @Override
 public void setEnabled(boolean e) {
   model.setEnabled(e);
 }
Example #7
0
 @Override
 public boolean isEnabled() {
   return model.isEnabled();
 }
Example #8
0
 @Override
 public boolean isPressed() {
   return model.isPressed();
 }
Example #9
0
 @Override
 public boolean isRollover() {
   return model.isRollover();
 }
Example #10
0
 @Override
 public boolean consumePress() {
   return model.consumePress();
 }