Java Code Examples for com.jme3.input.event.MouseButtonEvent#setTime()

The following examples show how to use com.jme3.input.event.MouseButtonEvent#setTime() . 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 5 votes vote down vote up
@Override
public void mousePressed(MouseEvent awtEvt) {
    // Must flip Y!
    int y = component.getHeight() - awtEvt.getY();
    MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(awtEvt), true, awtEvt.getX(), y);
    evt.setTime(awtEvt.getWhen());
    synchronized (eventQueue) {
        eventQueue.add(evt);
    }
}
 
Example 2
Source File: AwtMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseReleased(MouseEvent awtEvt) {
    int y = component.getHeight() - awtEvt.getY();
    MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(awtEvt), false, awtEvt.getX(), y);
    evt.setTime(awtEvt.getWhen());
    synchronized (eventQueue) {
        eventQueue.add(evt);
    }
}
 
Example 3
Source File: AWTMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void onMouseButton(MouseEvent event, final boolean pressed) {

        final MouseButtonEvent mouseButtonEvent = new MouseButtonEvent(convertButton(event.getButton()), pressed, mouseX, mouseY);
        mouseButtonEvent.setTime(getInputTimeNanos());

        EXECUTOR.addToExecute(new Runnable() {

          @Override
          public void run() {
            mouseButtonEvents.add(mouseButtonEvent);
          }
          
        });
    }
 
Example 4
Source File: AwtMouseInput.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void mousePressed(MouseEvent arg0) {
    MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(arg0), true, arg0.getX(), arg0.getY());
    evt.setTime(arg0.getWhen());
    synchronized (eventQueue){
        eventQueue.add(evt);
    }
}
 
Example 5
Source File: AwtMouseInput.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void mouseReleased(MouseEvent arg0) {
    MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(arg0), false, arg0.getX(), arg0.getY());
    evt.setTime(arg0.getWhen());
    synchronized (eventQueue){
        eventQueue.add(evt);
    }
}
 
Example 6
Source File: GlfwMouseInputVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void onMouseButton(final long window, final int button, final int action, final int mods) {
    final MouseButtonEvent mouseButtonEvent = new MouseButtonEvent(convertButton(button), action == GLFW_PRESS, mouseX, mouseY);
    mouseButtonEvent.setTime(getInputTimeNanos());
    mouseButtonEvents.add(mouseButtonEvent);
}
 
Example 7
Source File: GlfwMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void onMouseButton(final long window, final int button, final int action, final int mods) {
    final boolean pressed = action == GLFW_PRESS;
    final MouseButtonEvent mouseButtonEvent = new MouseButtonEvent(convertButton(button), pressed, mouseX, mouseY);
    mouseButtonEvent.setTime(getInputTimeNanos());
    mouseButtonEvents.add(mouseButtonEvent);
}