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