Exemple #1
0
  private static Window createWindow(
      int width, int height, String title, Monitor monitor, Window share) {
    setHints();

    if (fullScreen) {
      if (monitor == null) monitor = Monitor.getPrimaryMonitor();

      if (videoMode == null) videoMode = monitor.getVideoMode();

      width = videoMode.getWidth();
      height = videoMode.getHeight();
    }

    Window window = new Window(width, height, title, monitor, share);
    window.makeCurrent();
    setCallbacks(window);
    clearHints();

    if (cursorHidden) window.setInputMode(GLFW_CURSOR, GLFW_CURSOR_HIDDEN);

    if (cursorGrabbed) window.setInputMode(GLFW_CURSOR, GLFW_CURSOR_DISABLED);

    if (!fullScreen) window.setPosition(posX, posY);

    if (cursor == null) defaultCursor = cursor = new Cursor(Cursor.Type.ARROW);

    window.setCursor(cursor);

    dirty = true;

    VertexArray.CURRENT = null;
    setVSync(vSync);

    return window;
  }
Exemple #2
0
  public static void grabCursor() {
    cursorHidden = cursorGrabbed = true;

    if (displayWindow == null) return;

    displayWindow.setInputMode(GLFW_CURSOR, GLFW_CURSOR_DISABLED);
  }
Exemple #3
0
  public static void showCursor() {
    cursorHidden = cursorGrabbed = false;

    if (displayWindow == null) return;

    displayWindow.setInputMode(GLFW_CURSOR, GLFW_CURSOR_NORMAL);
  }
Exemple #4
0
  public static void hideCursor() {
    cursorHidden = !(cursorGrabbed = false);

    if (displayWindow == null) return;

    displayWindow.setInputMode(GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
  }