use of org.terasology.input.events.MouseAxisEvent in project Terasology by MovingBlocks.
the class InputSystem method processMouseInput.
private void processMouseInput(float delta) {
if (!isCapturingMouse()) {
return;
}
Vector2i deltaMouse = mouse.getDelta();
// process mouse movement x axis
if (deltaMouse.x != 0) {
float xValue = deltaMouse.x * inputDeviceConfig.getMouseSensitivity();
MouseAxisEvent event = MouseAxisEvent.create(MouseAxis.X, xValue, delta);
send(event);
}
// process mouse movement y axis
if (deltaMouse.y != 0) {
int yMovement = inputDeviceConfig.isMouseYAxisInverted() ? deltaMouse.y * -1 : deltaMouse.y;
float yValue = yMovement * inputDeviceConfig.getMouseSensitivity();
MouseAxisEvent event = MouseAxisEvent.create(MouseAxis.Y, yValue, delta);
send(event);
}
// process mouse clicks
for (MouseAction action : mouse.getInputQueue()) {
switch(action.getInput().getType()) {
case MOUSE_BUTTON:
processMouseButtonInput(delta, action);
break;
case MOUSE_WHEEL:
processMouseWheelInput(delta, action);
break;
default:
break;
}
}
}
Aggregations