Search in sources :

Example 1 with JoyAxisTrigger

use of com.jme3.input.controls.JoyAxisTrigger in project jmonkeyengine by jMonkeyEngine.

the class DefaultJoystickAxis method assignAxis.

/**
     *  Assign the mappings to receive events from the given joystick axis.
     *
     *  @param positiveMapping The mapping to receive events when the axis is negative
     *  @param negativeMapping The mapping to receive events when the axis is positive
     */
public void assignAxis(String positiveMapping, String negativeMapping) {
    if (axisIndex != -1) {
        inputManager.addMapping(positiveMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, false));
        inputManager.addMapping(negativeMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, true));
    }
}
Also used : JoyAxisTrigger(com.jme3.input.controls.JoyAxisTrigger)

Example 2 with JoyAxisTrigger

use of com.jme3.input.controls.JoyAxisTrigger in project jmonkeyengine by jMonkeyEngine.

the class AbstractJoystick method assignAxis.

/**
     * Assign the mappings to receive events from the given joystick axis.
     *
     * @param positiveMapping The mapping to receive events when the axis is negative
     * @param negativeMapping The mapping to receive events when the axis is positive
     * @param axisId The axis index.
     *
     * @see Joystick#getAxisCount()
     * @deprecated Use JoystickAxis.assignAxis() instead.
     */
@Override
public void assignAxis(String positiveMapping, String negativeMapping, int axisId) {
    // For backwards compatibility
    if (axisId == JoyInput.AXIS_POV_X) {
        axisId = getPovXAxis().getAxisId();
    } else if (axisId == JoyInput.AXIS_POV_Y) {
        axisId = getPovYAxis().getAxisId();
    }
    inputManager.addMapping(positiveMapping, new JoyAxisTrigger(joyId, axisId, false));
    inputManager.addMapping(negativeMapping, new JoyAxisTrigger(joyId, axisId, true));
}
Also used : JoyAxisTrigger(com.jme3.input.controls.JoyAxisTrigger)

Aggregations

JoyAxisTrigger (com.jme3.input.controls.JoyAxisTrigger)2