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;
}
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);
}
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);
}
}
Aggregations