Package com.ardor3d.input

Examples of com.ardor3d.input.InputState


            _states.put(MouseButton.MIDDLE, middle);
        }
    }

    public boolean apply(final TwoInputStates states) {
        final InputState currentState = states.getCurrent();

        if (currentState == null) {
            return false;
        }

        for (final MouseButton button : _states.keySet()) {
            final ButtonState required = _states.get(button);
            if (required != ButtonState.UNDEFINED) {
                if (currentState.getMouseState().getButtonState(button) != required) {
                    return false;
                }
            }
        }
        return true;
View Full Code Here


/**
* Applicable whenever 'any' key has been pressed.
*/
public class AnyKeyCondition implements Predicate<TwoInputStates> {
    public boolean apply(final TwoInputStates twoInputStates) {
        final InputState currentState = twoInputStates.getCurrent();
        final InputState previousState = twoInputStates.getPrevious();

        return !currentState.getKeyboardState().getKeysPressedSince(previousState.getKeyboardState()).isEmpty();
    }
View Full Code Here

        _button = button;
    }

    public boolean apply(final TwoInputStates states) {
        final InputState currentState = states.getCurrent();

        return currentState.getMouseState().getButtonsClicked().contains(_button);
    }
View Full Code Here

        _button = button;
    }

    public boolean apply(final TwoInputStates states) {
        final InputState currentState = states.getCurrent();
        final InputState previousState = states.getPrevious();

        if (currentState == null || previousState == null
                || !currentState.getMouseState().hasButtonState(ButtonState.DOWN)) {
            return false;
        }

        return currentState.getMouseState().getButtonsPressedSince(previousState.getMouseState()).contains(_button);
    }
View Full Code Here

        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);
    }
View Full Code Here

* 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;
        }

View Full Code Here

        _button = button;
    }

    public boolean apply(final TwoInputStates states) {
        final InputState currentState = states.getCurrent();
        final InputState previousState = states.getPrevious();

        if (currentState == null || previousState == null
                || !previousState.getMouseState().hasButtonState(ButtonState.DOWN)) {
            return false;
        }

        return currentState.getMouseState().getButtonsReleasedSince(previousState.getMouseState()).contains(_button);
    }
View Full Code Here

* 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;
        }

View Full Code Here

        this.key = key;
    }

    public boolean apply(final TwoInputStates states) {
        final InputState currentState = states.getCurrent();
        final InputState previousState = states.getPrevious();

        return currentState.getKeyboardState().getKeysPressedSince(previousState.getKeyboardState()).contains(key);
    }
View Full Code Here

                            forwardTo.getApplier()
                                    .checkAndPerformTriggers(forwardTo.getTriggers(), source, states, tpf);
                        } else {
                            // only key state consumed
                            final TwoInputStates forwardingState = new TwoInputStates(states.getPrevious(),
                                    new InputState(KeyboardState.NOTHING, states.getCurrent().getMouseState(), states
                                            .getCurrent().getControllerState()));
                            forwardTo.getApplier().checkAndPerformTriggers(forwardTo.getTriggers(), source,
                                    forwardingState, tpf);
                        }
                    } else {
                        if (!_keyInputConsumed) {
                            // only mouse consumed
                            final TwoInputStates forwardingState = new TwoInputStates(states.getPrevious(),
                                    new InputState(states.getCurrent().getKeyboardState(), MouseState.NOTHING, states
                                            .getCurrent().getControllerState()));
                            forwardTo.getApplier().checkAndPerformTriggers(forwardTo.getTriggers(), source,
                                    forwardingState, tpf);
                        } else {
                            // both consumed, do nothing.
View Full Code Here

TOP

Related Classes of com.ardor3d.input.InputState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.