Search in sources :

Example 1 with BindableRealAxis

use of org.terasology.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.input.internal.BindableRealAxis)

Example 2 with BindableRealAxis

use of org.terasology.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.input.internal.BindableRealAxis)

Example 3 with BindableRealAxis

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

the class InputSystem method processControllerAxisInput.

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.config.ControllerConfig.ControllerInfo) BindableRealAxis(org.terasology.input.internal.BindableRealAxis)

Aggregations

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