コード例 #1
0
  /**
   * Create the native window peer from the given mode and fullscreen flag. A native context must
   * exist, and it will be attached to the window.
   */
  private static void createWindow() throws LWJGLException {
    if (window_created) {
      return;
    }
    Canvas tmp_parent = isFullscreen() ? null : parent;
    if (tmp_parent != null
        && !tmp_parent
            .isDisplayable()) // Only a best effort check, since the parent can turn undisplayable
                              // hereafter
    throw new LWJGLException("Parent.isDisplayable() must be true");
    if (tmp_parent != null) {
      tmp_parent.addComponentListener(component_listener);
    }
    DisplayMode mode = getEffectiveMode();
    display_impl.createWindow(drawable, mode, tmp_parent, getWindowX(), getWindowY());
    window_created = true;

    width = Display.getDisplayMode().getWidth();
    height = Display.getDisplayMode().getHeight();

    setTitle(title);
    initControls();

    // set cached window icon if exists
    if (cached_icons != null) {
      setIcon(cached_icons);
    } else {
      setIcon(new ByteBuffer[] {LWJGLUtil.LWJGLIcon32x32, LWJGLUtil.LWJGLIcon16x16});
    }
  }