/** * Draw the current state of the scene. */ @MainThread boolean draw();
private static class InputSource { private final Canvas source; private final PhysicalLayer physicalLayer; @GuardedBy("LogicalLayer.this") private InputState lastState; public InputSource(final Canvas source, final PhysicalLayer physicalLayer) { this.source = source; this.physicalLayer = physicalLayer; lastState = InputState.EMPTY; } }
@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); } }
/** * Draw the current state of the scene. */ @MainThread boolean draw();
private static class InputSource { private final Canvas source; private final PhysicalLayer physicalLayer; @GuardedBy("LogicalLayer.this") private InputState lastState; public InputSource(final Canvas source, final PhysicalLayer physicalLayer) { this.source = source; this.physicalLayer = physicalLayer; lastState = InputState.EMPTY; } }
/** * 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; } }
/** * Render the object using the supplied renderer instance. * * @param renderer * @return true if a render occurred */ @MainThread boolean render(Renderer renderer); }
/** * 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; } }
/** * Do work to initialize this canvas, generally setting up the associated CanvasRenderer, etc. */ @MainThread void init();
/** * 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; } }
/** * Ask the canvas to render itself. Note that this may occur in another thread and therefore a latch is given so the * caller may know when the draw has completed. * * @param latch * a counter that should be decremented once drawing has completed. */ @MainThread void draw(CountDownLatch latch);
/** * * @param renderer * @return true if a render occurred and we should swap the buffers. */ @MainThread boolean renderUnto(Renderer renderer);
/** * Do work to initialize this canvas, generally setting up the associated CanvasRenderer, etc. */ @MainThread void init();
/** * Ask the canvas to render itself. Note that this may occur in another thread and therefore a latch is given so the * caller may know when the draw has completed. * * @param latch * a counter that should be decremented once drawing has completed. */ @MainThread void draw(CountDownLatch latch);
@MainThread public void update(final ReadOnlyTimer timer); }
/** * Implementing classes should implementing this method to take whatever action is desired. This method will always * be called on the main GL thread. * * @param source * the Canvas that was the source of the current input * @param inputState * the current and previous states of the input system when the action was triggered * @param tpf * the time per frame in seconds */ @MainThread public void perform(Canvas source, TwoInputStates inputStates, double tpf); }
/** * Implementing classes should implementing this method to take whatever action is desired. This method will always * be called on the main GL thread. * * @param source * the Canvas that was the source of the current input * @param inputState * the current and previous states of the input system when the action was triggered * @param tpf * the time per frame in seconds */ @MainThread public void perform(Canvas source, TwoInputStates inputStates, double tpf); }
@MainThread public void update(final ReadOnlyTimer timer); }
@MainThread public void init();
@MainThread public void init();