예제 #1
0
  public static void setFullScreen(boolean fullScreen) {
    if (Display.fullScreen == fullScreen) return;

    Display.fullScreen = fullScreen;

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

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

      // Save window size
      oldWidth = width;
      oldHeight = height;

      // Save window position
      oldPosX = posX;
      oldPosY = posY;

      width = videoMode.getWidth();
      height = videoMode.getHeight();
    } else {
      // Restore window size
      width = oldWidth;
      height = oldHeight;

      // Restore window position
      posX = oldPosX;
      posY = oldPosY;

      monitor = null;
      videoMode = null;
    }

    if (displayWindow == null) return;

    // Create new window
    Window fsDisplayWindow =
        createWindow(width, height, displayWindow.getTitle(), monitor, displayWindow);
    displayWindow.destroy();
    displayWindow = fsDisplayWindow;
    displayWindow.makeCurrent();

    setPosition(posX, posY);
    setSize(width, height);

    hide();
    show();

    // Make an update
    update();

    dirty = true;
    resized = true;
  }
예제 #2
0
  public static void setMonitor(Monitor monitor) {
    if (Display.monitor == monitor) return;

    Display.monitor = monitor;
    Display.fullScreen = monitor != null;

    if (displayWindow == null) return;

    videoMode =
        monitor == null ? Monitor.getPrimaryMonitor().getVideoMode() : monitor.getVideoMode();

    // Save window size
    oldWidth = width;
    oldHeight = height;

    // Save window position
    oldPosX = posX;
    oldPosY = posY;

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

    // Create new window
    Window fsDisplayWindow =
        createWindow(width, height, displayWindow.getTitle(), monitor, displayWindow);
    displayWindow.destroy();
    displayWindow = fsDisplayWindow;
    displayWindow.makeCurrent();

    setPosition(posX, posY);
    setSize(width, height);

    hide();
    show();

    // Make an update
    update();

    dirty = true;
    resized = true;
  }
예제 #3
0
  public static void setResizable(boolean resizable) {
    if (Display.resizable == resizable) return;

    Display.resizable = resizable;

    if (fullScreen) return;

    if (displayWindow != null) {
      Window resizableWindow = createWindow(width, height, getTitle(), monitor, displayWindow);

      displayWindow.destroy();
      displayWindow = resizableWindow;
      displayWindow.makeCurrent();

      dirty = true;

      hide();
      show();

      // Update the Display
      update();
    }
  }
예제 #4
0
  public static void setDecorated(boolean decorated) {
    if (Display.decorated == decorated) return;

    Display.decorated = decorated;

    if (fullScreen) return;

    if (displayWindow != null) {
      Window newWindow = createWindow(width, height, getTitle(), monitor, displayWindow);

      displayWindow.destroy();
      displayWindow = newWindow;
      displayWindow.makeCurrent();

      dirty = true;

      hide();
      show();

      // Update the Display
      update();
    }
  }
예제 #5
0
  public static void destroy() {
    if (displayWindow != null) displayWindow.destroy();

    if (defaultCursor != null) defaultCursor.destroy();
  }