示例#1
0
 private void updateCursor() {
   try {
     if (mouse != null && shouldGrab()) nSetNativeCursor(getHwnd(), mouse.getBlankCursor());
     else nSetNativeCursor(getHwnd(), current_cursor);
   } catch (LWJGLException e) {
     LWJGLUtil.log("Failed to update cursor: " + e);
   }
 }
示例#2
0
 private void updateClipping() {
   if ((Display.isFullscreen() || (mouse != null && mouse.isGrabbed()))
       && !isMinimized
       && isFocused
       && (getForegroundWindow() == getHwnd() || hasParent)) {
     try {
       setupCursorClipping(getHwnd());
     } catch (LWJGLException e) {
       LWJGLUtil.log("setupCursorClipping failed: " + e.getMessage());
     }
   } else {
     resetCursorClipping();
   }
 }
示例#3
0
  private void handleMouseButton(int button, int state, long millis) {
    if (mouse != null) {
      mouse.handleMouseButton((byte) button, (byte) state, millis);

      // need to capture?
      if (captureMouse == -1 && button != -1 && state == 1) {
        captureMouse = button;
        nSetCapture(hwnd);
      }

      // done with capture?
      if (captureMouse != -1 && button == captureMouse && state == 0) {
        captureMouse = -1;
        nReleaseCapture();
      }
    }
  }
示例#4
0
 private void handleMouseScrolled(int amount, long millis) {
   if (mouse != null) mouse.handleMouseScrolled(amount, millis);
 }
示例#5
0
 private void handleMouseMoved(int x, int y, long millis) {
   if (mouse != null) {
     mouse.handleMouseMoved(x, y, millis, shouldGrab());
   }
 }
示例#6
0
 private void setMousePosition(int x, int y) {
   if (mouse != null) mouse.setPosition(x, y);
 }
示例#7
0
 public void grabMouse(boolean grab) {
   mouse.grab(grab, shouldGrab());
   updateCursor();
 }
示例#8
0
 public void readMouse(ByteBuffer buffer) {
   mouse.read(buffer);
 }
示例#9
0
 public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
   mouse.poll(coord_buffer, buttons);
 }
示例#10
0
 public void destroyMouse() {
   if (mouse != null) mouse.destroy();
   mouse = null;
 }
示例#11
0
 public int getButtonCount() {
   return mouse.getButtonCount();
 }
示例#12
0
 /* Mouse */
 public boolean hasWheel() {
   return mouse.hasWheel();
 }