com.badlogic.gdx.Graphics.setWindowedMode()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中com.badlogic.gdx.Graphics.setWindowedMode()方法的一些代码示例,展示了Graphics.setWindowedMode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics.setWindowedMode()方法的具体详情如下:
包路径:com.badlogic.gdx.Graphics
类名称:Graphics
方法名:setWindowedMode

Graphics.setWindowedMode介绍

[英]Sets the window to windowed mode.
[中]将窗口设置为窗口模式。

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
  public void clicked (InputEvent event, float x, float y) {
    super.clicked(event, x, y);
    if (isWindowed) {
      isWindowed = false;
      changeModeButton.setText(fullScreenInstructions);
      Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
    } else {
      isWindowed = true;
      changeModeButton.setText(windowedInstructions);
      Gdx.graphics.setWindowedMode(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    }
  }
});

代码示例来源:origin: libgdx/libgdx

Gdx.graphics.setWindowedMode(480, 320);
batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());

代码示例来源:origin: com.github.nifty-gui/nifty-examples-libgdx-core

public boolean apply() {
   boolean wasApplied = Gdx.graphics.setWindowedMode(width, height);
   if (wasApplied) {
    Gdx.gl.glViewport(0, 0, width, height);
/*        Gdx.gl.glMatr(GL11.GL_PROJECTION);
    Gdx.gl.glLoadIdentity();
    Gdx.gl.glOrthof(0.0f, (float) width, height, 0.0f, -9999.0f, 9999.0f);
    Gdx.gl.glMatrixMode(GL11.GL_MODELVIEW);
    Gdx.gl.glLoadIdentity();*/
   }
   return wasApplied;
  }

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

public Main(Editor editor, LwjglApplicationConfiguration cfg) {
  super(editor, cfg);
  Gdx.graphics.setWindowedMode(Math.max((int) (Gdx.graphics.getDisplayMode().width * 0.9), 1920 / 2),
      Math.max((int) (Gdx.graphics.getDisplayMode().height * 0.9), 1080 / 2));
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

public void toggleFullScreen() {
  if (!fullscreen) {
    Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
    fullscreen = true;
  } else {
    Gdx.graphics.setWindowedMode(w.getWidth(), w.getHeight());
    fullscreen = false;
  }
}

代码示例来源:origin: 00-Evan/shattered-pixel-dungeon-gdx

public static void fullscreen( boolean value ) {
  if (value) {
    put(KEY_WINDOW_FULLSCREEN, true);
    Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
  } else {
    int w = getInt(KEY_WINDOW_WIDTH, DEFAULT_WINDOW_WIDTH);
    int h = getInt(KEY_WINDOW_HEIGHT, DEFAULT_WINDOW_HEIGHT);
    put(KEY_WINDOW_FULLSCREEN, false);
    Gdx.graphics.setWindowedMode(w, h);
  }
}

代码示例来源:origin: jsjolund/GdxDemo3D

public void toggleFullscreen() {
  if (Gdx.graphics.isFullscreen()) {
    Gdx.app.debug(TAG, "Disabling fullscreen w=" + WIDTH + ", h=" + HEIGHT);
    Gdx.graphics.setWindowedMode(WIDTH, HEIGHT);
  } else {
    Gdx.app.debug(TAG, "Enabling fullscreen w=" + Gdx.graphics.getDisplayMode().width + ", h="
        + Gdx.graphics.getDisplayMode().height);
    Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
  }
}

代码示例来源:origin: langurmonkey/gaiasky

int height = GlobalConf.screen.SCREEN_HEIGHT;
boolean good = Gdx.graphics.setWindowedMode(width, height);
if (!good) {
  logger.error(I18n.bundle.format("notif.error", I18n.bundle.get("gui.windowed")));

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

Gdx.graphics.setWindowedMode(Math.max((int) (Gdx.graphics.getDisplayMode().width * 0.9), 1920 / 2),
    Math.max((int) (Gdx.graphics.getDisplayMode().height * 0.9), 1080 / 2));

相关文章