Search in sources :

Example 1 with BindableRealAxis

use of org.terasology.engine.input.internal.BindableRealAxis in project Terasology by MovingBlocks.

the class InputSystem method processControllerAxisInput.

/**
 * Processes input actions by controller axis, and updates bind axis accordingly.
 *
 * @param action The input action to be processed.
 * @param input The specific input of the controller axis.
 */
private void processControllerAxisInput(ControllerAction action, Input input) {
    BindableRealAxis axis = bindsManager.getControllerAxisBinds().get(input);
    if (axis != null) {
        ControllerInfo info = inputDeviceConfig.getController(action.getController());
        boolean isX = action.getInput().getId() == ControllerId.X_AXIS;
        boolean isY = action.getInput().getId() == ControllerId.Y_AXIS;
        boolean isZ = action.getInput().getId() == ControllerId.Z_AXIS;
        float f = (isX && info.isInvertX() || isY && info.isInvertY() || isZ && info.isInvertZ()) ? -1 : 1;
        axis.setTargetValue(action.getAxisValue() * f);
    }
}
Also used : ControllerInfo(org.terasology.engine.config.ControllerConfig.ControllerInfo) BindableRealAxis(org.terasology.engine.input.internal.BindableRealAxis)

Example 2 with BindableRealAxis

use of org.terasology.engine.input.internal.BindableRealAxis in project Terasology by MovingBlocks.

the class BindsSubsystem method registerRealBindAxis.

private BindableAxis registerRealBindAxis(String id, BindAxisEvent event) {
    BindableRealAxis axis = new BindableRealAxis(id.toString(), event);
    axisBinds.add(axis);
    axisLookup.put(id, axis);
    return axis;
}
Also used : BindableRealAxis(org.terasology.engine.input.internal.BindableRealAxis)

Example 3 with BindableRealAxis

use of org.terasology.engine.input.internal.BindableRealAxis in project Terasology by MovingBlocks.

the class BindsSubsystem method linkAxisToInput.

private void linkAxisToInput(Input input, SimpleUri bindId) {
    BindableRealAxis bindInfo = axisLookup.get(bindId.toString());
    controllerAxisBinds.put(input, bindInfo);
}
Also used : BindableRealAxis(org.terasology.engine.input.internal.BindableRealAxis)

Aggregations

BindableRealAxis (org.terasology.engine.input.internal.BindableRealAxis)3 ControllerInfo (org.terasology.engine.config.ControllerConfig.ControllerInfo)1