Exemple #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;
  }
Exemple #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;
  }
Exemple #3
0
 public static String getTitle() {
   return displayWindow.getTitle();
 }