@Override public void create () { DisplayMode displayMode = Gdx.graphics.getDisplayMode(); DisplayMode displayModeForMonitor = Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor()); DisplayMode[] displayModes = Gdx.graphics.getDisplayModes(); DisplayMode[] displayModesForMonitor = Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor()); Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayMode() ) : " + displayMode); Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor()) ) : " + Arrays.toString(displayModes)); Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayModes() ) : " + Arrays.toString(displayModesForMonitor)); Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor()) ): " + displayModeForMonitor); assertDisplayModeEquals(displayMode, displayModeForMonitor); assertDisplayModesEquals(displayModes, displayModesForMonitor); }
DisplayMode mode = app.getGraphics().getDisplayMode(); if (((rotation == 0 || rotation == 180) && (mode.width >= mode.height)) || ((rotation == 90 || rotation == 270) && (mode.width <= mode.height))) {
DisplayMode mode = app.getGraphics().getDisplayMode(); if (((rotation == 0 || rotation == 180) && (mode.width >= mode.height)) || ((rotation == 90 || rotation == 270) && (mode.width <= mode.height))) {
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
@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()); } } });
mymode = Gdx.graphics.getDisplayMode(m); GlobalConf.screen.FULLSCREEN_WIDTH = mymode.width; GlobalConf.screen.FULLSCREEN_HEIGHT = mymode.height;
@Override public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); font.draw(batch, "accel: [" + Gdx.input.getAccelerometerX() + "," + Gdx.input.getAccelerometerY() + "," + Gdx.input.getAccelerometerZ() + "]\n" + "orientation: " + Gdx.input.getNativeOrientation() + "\n" + "rotation: " + Gdx.input.getRotation() + "\n" + "wh: " + Gdx.graphics.getDisplayMode() + "\n", 0, 100); batch.end(); }
DisplayMode nativeMode = Gdx.graphics.getDisplayMode(); widthValidator = new IntValidator(100, nativeMode.width); widthField = new OwnTextField(Integer.toString(MathUtils.clamp(GlobalConf.screen.SCREEN_WIDTH, 100, nativeMode.width)), skin, widthValidator);
@Override public int getScreenWidth() { return Gdx.graphics.getDisplayMode().width; }
@Override public int getScreenHeight() { return Gdx.graphics.getDisplayMode().height; }
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)); }
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()); } }
@Override public void create() { // Gdx.input.setCursorCatched(false); if (fullscreen) Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); hideCursor(); super.create(); }
@Override public void resize(int width, int height) { super.resize(width, height); Graphics.DisplayMode mode = Gdx.graphics.getDisplayMode(); boolean maximized = width >= mode.width || height >= mode.height; if (!maximized && !SPDSettings.fullscreen()){ SPDSettings.put(SPDSettings.KEY_WINDOW_WIDTH, width); SPDSettings.put(SPDSettings.KEY_WINDOW_HEIGHT, height); } }
public void toggleFullScreen() { if (!fullscreen) { Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); fullscreen = true; } else { Gdx.graphics.setWindowedMode(w.getWidth(), w.getHeight()); fullscreen = false; } }
@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(); } }
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); } }
@Override public void create() { if (!Parameters.CUSTOM_COORD_SCALE) { if (Math.min(Gdx.graphics.getDisplayMode().width, Gdx.graphics.getDisplayMode().height) > 1080) MapRenderer.COORD_SCALE = 4.0f; } mMap = new MapAdapter(); mMapRenderer = new MapRenderer(mMap); Gdx.graphics.setContinuousRendering(false); Gdx.app.setLogLevel(Application.LOG_DEBUG); int w = Gdx.graphics.getWidth(); int h = Gdx.graphics.getHeight(); mMap.viewport().setViewSize(w, h); mMapRenderer.onSurfaceCreated(); mMapRenderer.onSurfaceChanged(w, h); InputMultiplexer mux = new InputMultiplexer(); if (!Parameters.MAP_EVENT_LAYER2) { mGestureDetector = new GestureDetector(new GestureHandlerImpl(mMap)); mux.addProcessor(mGestureDetector); } mux.addProcessor(new InputHandler(this)); mux.addProcessor(new MotionHandler(mMap)); Gdx.input.setInputProcessor(mux); createLayers(); }
engineCallback.preLoad(Gdx.graphics.getDisplayMode(), engineConfig.assets);
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));