@Immutable public class SwipeGestureEvent extends PanGestureEvent { public SwipeGestureEvent(final Rectangle2 bounds, final int touches, final int xDirection, final int yDirection) { this(System.nanoTime(), bounds, touches, xDirection, yDirection); } public SwipeGestureEvent(final long nanos, final Rectangle2 bounds, final int touches, final int xDirection, final int yDirection) { super(nanos, false, bounds, touches, xDirection, yDirection); } @Override public String toString() { return MessageFormat.format("SwipeGestureEvent: touches: {0} x: {1} y: {2}", _touches, _xDirection, _yDirection); } }
@Immutable public class LongPressGestureEvent extends AbstractGestureEvent { public int _touches; public LongPressGestureEvent(final Rectangle2 bounds, final int touches) { this(System.nanoTime(), bounds, touches); } public LongPressGestureEvent(final long nanos, final Rectangle2 bounds, final int touches) { super(nanos, false, bounds); _touches = touches; } public int getTouches() { return _touches; } @Override public String toString() { return MessageFormat.format("LongPressGestureEvent: touches={0}", _touches); } }
/** * A condition that is true if the mouse has moved between the two input states. */ @Immutable public final class MouseMovedCondition implements Predicate<TwoInputStates> { public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); if (currentState == null) { return false; } if (currentState.equals(previousState)) { return false; } return currentState.getMouseState().getDx() != 0 || currentState.getMouseState().getDy() != 0; } }
/** * A condition that is true if the mouse wheel has moved between the two input states. */ @Immutable public final class MouseWheelMovedCondition implements Predicate<TwoInputStates> { public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); if (currentState == null) { return false; } if (currentState.equals(previousState)) { return false; } return currentState.getMouseState().getDwheel() != 0; } }
/** * A condition that is true if the mouse has moved between the two input states. */ @Immutable public final class MouseMovedCondition implements Predicate<TwoInputStates> { public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); if (currentState == null) { return false; } if (currentState.equals(previousState)) { return false; } return currentState.getMouseState().getDx() != 0 || currentState.getMouseState().getDy() != 0; } }
/** * A condition that is true if the mouse wheel has moved between the two input states. */ @Immutable public final class MouseWheelMovedCondition implements Predicate<TwoInputStates> { public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); if (currentState == null) { return false; } if (currentState.equals(previousState)) { return false; } return currentState.getMouseState().getDwheel() != 0; } }
@Immutable public class PinchGestureEvent extends AbstractGestureEvent { protected final double _scale; public PinchGestureEvent(final boolean startOfGesture, final Rectangle2 bounds, final double scale) { this(System.nanoTime(), startOfGesture, bounds, scale); } public PinchGestureEvent(final long nanos, final boolean startOfGesture, final Rectangle2 bounds, final double scale) { super(nanos, startOfGesture, bounds); _scale = scale; } public double getScale() { return _scale; } @Override public String toString() { return MessageFormat.format("PinchGestureEvent: {0,number,percent}", _scale); } }
/** * A condition that is true when a key is down in the current input state. */ @Immutable public final class KeyHeldCondition implements Predicate<TwoInputStates> { private final Key key; /** * Construct a new KeyHeldCondition. * * @param key * the key that should be held * @throws NullPointerException * if the key is null */ public KeyHeldCondition(final Key key) { if (key == null) { throw new NullPointerException(); } this.key = key; } public boolean apply(final TwoInputStates states) { return states.getCurrent().getKeyboardState().isDown(key); } }
@Immutable public final class MouseButtonPressedCondition implements Predicate<TwoInputStates> { private final MouseButton _button;
/** * A condition that is true when a key is down in the current input state. */ @Immutable public final class KeyHeldCondition implements Predicate<TwoInputStates> { private final Key key; /** * Construct a new KeyHeldCondition. * * @param key * the key that should be held * @throws NullPointerException * if the key is null */ public KeyHeldCondition(final Key key) { if (key == null) { throw new NullPointerException(); } this.key = key; } public boolean apply(final TwoInputStates states) { return states.getCurrent().getKeyboardState().isDown(key); } }
@Immutable public final class MouseButtonPressedCondition implements Predicate<TwoInputStates> { private final MouseButton _button;
@Immutable public final class KeyPressedCondition implements Predicate<TwoInputStates> { private final Key key;
@Immutable public final class KeyPressedCondition implements Predicate<TwoInputStates> { private final Key key;
/** * A condition that is true when a key was released from the previous to the current input state. */ @Immutable public final class KeyReleasedCondition implements Predicate<TwoInputStates> { private final Key key; /** * Construct a new KeyReleasedCondition. * * @param key * the key that should be held * @throws NullPointerException * if the key is null */ public KeyReleasedCondition(final Key key) { if (key == null) { throw new NullPointerException(); } this.key = key; } public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); return currentState.getKeyboardState().getKeysReleasedSince(previousState.getKeyboardState()).contains(key); } }
@Immutable public final class MouseButtonClickedCondition implements Predicate<TwoInputStates> { private final MouseButton _button;
@Immutable public class RotateGestureEvent extends AbstractGestureEvent {
/** * A condition that is true when a key was released from the previous to the current input state. */ @Immutable public final class KeyReleasedCondition implements Predicate<TwoInputStates> { private final Key key; /** * Construct a new KeyReleasedCondition. * * @param key * the key that should be held * @throws NullPointerException * if the key is null */ public KeyReleasedCondition(final Key key) { if (key == null) { throw new NullPointerException(); } this.key = key; } public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); return currentState.getKeyboardState().getKeysReleasedSince(previousState.getKeyboardState()).contains(key); } }
@Immutable public final class MouseButtonClickedCondition implements Predicate<TwoInputStates> { private final MouseButton _button;
@Immutable public final class MouseButtonReleasedCondition implements Predicate<TwoInputStates> { private final MouseButton _button;
@Immutable public final class MouseButtonReleasedCondition implements Predicate<TwoInputStates> { private final MouseButton _button;