Search in sources :

Example 6 with ButtonState

use of org.terasology.input.ButtonState 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

ButtonState (org.terasology.input.ButtonState)6 Input (org.terasology.input.Input)4 ControllerAction (org.terasology.input.device.ControllerAction)2 MouseAction (org.terasology.input.device.MouseAction)2 ByteBuffer (java.nio.ByteBuffer)1 FloatBuffer (java.nio.FloatBuffer)1 Component (net.java.games.input.Component)1 Identifier (net.java.games.input.Component.Identifier)1 Button (net.java.games.input.Component.Identifier.Button)1 GLFWGamepadState (org.lwjgl.glfw.GLFWGamepadState)1 ControllerInfo (org.terasology.config.ControllerConfig.ControllerInfo)1 MouseInput (org.terasology.input.MouseInput)1 KeyboardAction (org.terasology.input.device.KeyboardAction)1 RawKeyboardAction (org.terasology.input.device.RawKeyboardAction)1