Search in sources :

Example 1 with MouseInput

use of org.terasology.input.MouseInput in project Terasology by MovingBlocks.

the class UIInputBind method onMouseWheelEvent.

@Override
public void onMouseWheelEvent(NUIMouseWheelEvent event) {
    if (capturingInput) {
        MouseInput mouseInput = MouseInput.find(InputType.MOUSE_WHEEL, event.getWheelTurns());
        setNewInput(InputType.MOUSE_WHEEL.getInput(mouseInput.getId()));
        capturingInput = false;
        event.consume();
    }
}
Also used : MouseInput(org.terasology.input.MouseInput)

Example 2 with MouseInput

use of org.terasology.input.MouseInput in project Terasology by MovingBlocks.

the class UIInputBind method onMouseWheelEvent.

@Override
public void onMouseWheelEvent(MouseWheelEvent event) {
    if (capturingInput) {
        MouseInput mouseInput = MouseInput.find(InputType.MOUSE_WHEEL, event.getWheelTurns());
        setNewInput(InputType.MOUSE_WHEEL.getInput(mouseInput.getId()));
        capturingInput = false;
        event.consume();
    }
}
Also used : MouseInput(org.terasology.input.MouseInput)

Example 3 with MouseInput

use of org.terasology.input.MouseInput in project Terasology by MovingBlocks.

the class BindsSubsystem method linkBindButtonToInput.

private void linkBindButtonToInput(Input input, SimpleUri bindId) {
    switch(input.getType()) {
        case KEY:
            linkBindButtonToKey(input.getId(), bindId);
            break;
        case MOUSE_BUTTON:
            MouseInput button = MouseInput.find(input.getType(), input.getId());
            linkBindButtonToMouse(button, bindId);
            break;
        case MOUSE_WHEEL:
            linkBindButtonToMouseWheel(input.getId(), bindId);
            break;
        case CONTROLLER_BUTTON:
            linkBindButtonToController((ControllerInput) input, bindId);
            break;
        default:
            break;
    }
}
Also used : MouseInput(org.terasology.input.MouseInput)

Example 4 with MouseInput

use of org.terasology.input.MouseInput in project Terasology by MovingBlocks.

the class BindsSubsystem method linkBindButtonToInput.

private void linkBindButtonToInput(Input input, SimpleUri bindId) {
    switch(input.getType()) {
        case KEY:
            linkBindButtonToKey(input.getId(), bindId);
            break;
        case MOUSE_BUTTON:
            MouseInput button = MouseInput.find(input.getType(), input.getId());
            linkBindButtonToMouse(button, bindId);
            break;
        case MOUSE_WHEEL:
            linkBindButtonToMouseWheel(input.getId(), bindId);
            break;
        case CONTROLLER_BUTTON:
            linkBindButtonToController((ControllerInput) input, bindId);
            break;
        default:
            break;
    }
}
Also used : MouseInput(org.terasology.input.MouseInput)

Example 5 with MouseInput

use of org.terasology.input.MouseInput in project Terasology by MovingBlocks.

the class LwjglMouseDevice method mouseButtonCallback.

private void mouseButtonCallback(long window, int button, int action, int mods) {
    ButtonState state;
    if (action == GLFW.GLFW_PRESS) {
        state = ButtonState.DOWN;
        buttonStates.add(button);
    } else if (action == GLFW.GLFW_RELEASE) {
        state = ButtonState.UP;
        buttonStates.remove(button);
    } else /*if (action == GLFW.GLFW_REPEAT)*/
    {
        state = ButtonState.REPEAT;
    }
    MouseInput mouseInput = MouseInput.find(InputType.MOUSE_BUTTON, button);
    queue.offer(new MouseAction(mouseInput, state, getPosition()));
}
Also used : MouseAction(org.terasology.input.device.MouseAction) ButtonState(org.terasology.input.ButtonState) MouseInput(org.terasology.input.MouseInput)

Aggregations

MouseInput (org.terasology.input.MouseInput)7 MouseAction (org.terasology.input.device.MouseAction)2 MouseEvent (java.awt.event.MouseEvent)1 MouseListener (java.awt.event.MouseListener)1 MouseMotionListener (java.awt.event.MouseMotionListener)1 ButtonState (org.terasology.input.ButtonState)1