Java Code Examples for com.jme3.input.MouseInput#BUTTON_RIGHT

The following examples show how to use com.jme3.input.MouseInput#BUTTON_RIGHT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AwtMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private int getJMEButtonIndex(MouseEvent awtEvt) {
    int index;
    switch (awtEvt.getButton()) {
        default:
        case MouseEvent.BUTTON1: //left
            index = MouseInput.BUTTON_LEFT;
            break;
        case MouseEvent.BUTTON2: //middle
            index = MouseInput.BUTTON_MIDDLE;
            break;
        case MouseEvent.BUTTON3: //right
            index = MouseInput.BUTTON_RIGHT;
            break;
    }
    return index;
}
 
Example 2
Source File: TestIssue1283.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Configure the InputManager during startup.
 */
private void configureInputs() {
    final String launchActionName = "launch";
    ActionListener actionListener = new ActionListener() {
        @Override
        public void onAction(String name, boolean ongoing, float tpf) {
            if (ongoing) {
                if (name.equals(launchActionName)) {
                    launchProjectile();
                }
            }
        }
    };

    Trigger bTrigger = new KeyTrigger(KeyInput.KEY_B);
    Trigger rmbTrigger = new MouseButtonTrigger(MouseInput.BUTTON_RIGHT);
    inputManager.addMapping(launchActionName, bTrigger, rmbTrigger);
    inputManager.addListener(actionListener, launchActionName);
}
 
Example 3
Source File: AwtMouseInput.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int getJMEButtonIndex( MouseEvent arg0 ) {
    int index;
    switch (arg0.getButton()) {
        default:
        case MouseEvent.BUTTON1: //left
            index = MouseInput.BUTTON_LEFT;
            break;
        case MouseEvent.BUTTON2: //middle
            index = MouseInput.BUTTON_MIDDLE;
            break;
        case MouseEvent.BUTTON3: //right
            index = MouseInput.BUTTON_RIGHT;
            break;
    }
    return index;
}
 
Example 4
Source File: GlfwMouseInputVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Simply converts the GLFW button code to a JME button code. If there is no
 * match it just returns the GLFW button code. Bear in mind GLFW supports 8
 * different mouse buttons.
 *
 * @param glfwButton the raw GLFW button index.
 * @return the mapped {@link MouseInput} button id.
 */
private int convertButton(final int glfwButton) {
    switch (glfwButton) {
        case GLFW_MOUSE_BUTTON_LEFT:
        return MouseInput.BUTTON_LEFT;
        case GLFW_MOUSE_BUTTON_MIDDLE:
        return MouseInput.BUTTON_MIDDLE;
        case GLFW_MOUSE_BUTTON_RIGHT:
        return MouseInput.BUTTON_RIGHT;
        default:
            return glfwButton;
    }
}
 
Example 5
Source File: GlfwMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Simply converts the GLFW button code to a JME button code. If there is no
 * match it just returns the GLFW button code. Bear in mind GLFW supports 8
 * different mouse buttons.
 *
 * @param glfwButton the raw GLFW button index.
 * @return the mapped {@link MouseInput} button id.
 */
private int convertButton(final int glfwButton) {
    switch (glfwButton) {
        case GLFW_MOUSE_BUTTON_LEFT:
            return MouseInput.BUTTON_LEFT;
        case GLFW_MOUSE_BUTTON_MIDDLE:
            return MouseInput.BUTTON_MIDDLE;
        case GLFW_MOUSE_BUTTON_RIGHT:
            return MouseInput.BUTTON_RIGHT;
        default:
            return glfwButton;
    }
}