@Override public void create() { VisUI.load(); batch = new SpriteBatch(); shapeRenderer = new ShapeRenderer(); img = new Texture("splash.png"); font = new BitmapFont(Gdx.files.internal("font/openSans.fnt"), Gdx.files.internal("font/openSans.png"), false, true); window = ((Lwjgl3Graphics) Gdx.graphics).getWindow(); // start loading loadingTask = new LoadingTask(); try { loadingTask.execute(); } catch (Exception e) { e.printStackTrace(); } }
@Override public void centerWindow(Graphics graphics) { Lwjgl3Graphics g = (Lwjgl3Graphics) graphics; Graphics.DisplayMode mode = g.getDisplayMode(); Lwjgl3Window window = g.getWindow(); window.setPosition(mode.width / 2 - g.getWidth() / 2, mode.height / 2 - g.getHeight() / 2); }
private static Lwjgl3Window getCurrentWindow() { // Oddly, the only public way to get a reference to the main window is through the graphics object... Lwjgl3Graphics graphics = (Lwjgl3Graphics)Gdx.graphics; return graphics.getWindow(); }