示例#1
0
  /**
   * Called when the screen is resized, and sets some variables, like {@link JumboMathHandler#xmod}
   * and {@link JumboMathHandler#ymod}.
   */
  public static void update() {
    // JumboLaunchConfig config = JumboSettings.launchConfig;
    final int width, height;
    final float factor;
    if (JumboSettings.launchConfig.fullscreen) {
      final DisplayMode current = Display.getDisplayMode();
      factor = Display.getPixelScaleFactor();
      width = current.getWidth();
      height = current.getHeight();
    } else {
      width = Display.getWidth();
      height = Display.getHeight();
      factor = Display.getPixelScaleFactor();
    }
    // Dynamic resizing only works if its larger than the launch
    // dimensions.
    // If its not, it gets strectched, which looks a bit ugly. Because
    // of
    // this, developers should make their base window as small as
    // possible.
    // if (width < config.width || height < config.height) {
    // renderwidth = config.width;
    // renderheight = config.height;
    // GL11.glOrtho(0.0f, config.width, 0, config.height, 0.0f, 1.0f);
    // GL11.glViewport(0, 0, width, height);
    // Maths.currentdim = new Dimension(config.width, config.height);
    // } else {
    // for high dpi modes
    renderwidth = (int) (width * factor);
    renderheight = (int) (height * factor);

    for (JumboRenderModule m : modes) {
      m.resize(renderwidth, renderheight);
    }

    JumboPaintClass.getScene().onWindowUpdate();
    JumboPaintClass.getPreviousScene().onWindowUpdate();
    wasResized = false;
  }