public static boolean fullscreen() { return getBoolean(KEY_WINDOW_FULLSCREEN, Gdx.graphics.isFullscreen()); }
@Override public void resize() { //If the game has gone from full-screen to windowed if (lastFullScreenState && !Gdx.graphics.isFullscreen()) { Graphics.DisplayMode mode = Gdx.graphics.getDisplayMode(); ((Lwjgl3Graphics) Gdx.graphics).getWindow().setPosition(mode.width / 4, mode.height / 4); } lastFullScreenState = Gdx.graphics.isFullscreen(); } }
@Override public boolean keyUp (int keycode) { if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) { if (!Gdx.graphics.isFullscreen()) Gdx.graphics.setDisplayMode(Gdx.graphics.getDisplayModes()[0]); } return true; } });
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()); } }
p.setProperty("graphics.screen.width", Integer.toString(Gdx.graphics.isFullscreen() ? GlobalConf.screen.SCREEN_WIDTH : Gdx.graphics.getWidth())); p.setProperty("graphics.screen.height", Integer.toString(Gdx.graphics.isFullscreen() ? GlobalConf.screen.SCREEN_HEIGHT : Gdx.graphics.getHeight())); p.setProperty("graphics.screen.fullscreen.width", Integer.toString(!Gdx.graphics.isFullscreen() ? GlobalConf.screen.FULLSCREEN_WIDTH : Gdx.graphics.getWidth())); p.setProperty("graphics.screen.fullscreen.height", Integer.toString(!Gdx.graphics.isFullscreen() ? GlobalConf.screen.FULLSCREEN_HEIGHT : Gdx.graphics.getHeight())); p.setProperty("graphics.screen.fullscreen", Boolean.toString(Gdx.graphics.isFullscreen())); p.setProperty("graphics.screen.resizable", Boolean.toString(GlobalConf.screen.RESIZABLE)); p.setProperty("graphics.screen.vsync", Boolean.toString(GlobalConf.screen.VSYNC));
RedButton btnResolution = new RedButton(Gdx.graphics.isFullscreen() ? TXT_SWITCH_WIN : TXT_SWITCH_FULL ) { @Override protected void onClick() {
logger.info("Display mode", Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight(), "Fullscreen: " + Gdx.graphics.isFullscreen()); logger.info("Device", Gdx.gl.glGetString(GL20.GL_RENDERER)); logger.info(I18n.bundle.format("notif.glslversion", Gdx.gl.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)));