@Override public void render(float delta) { update(delta); Gdx.gl20.glClear( GL20.GL_COLOR_BUFFER_BIT | (Gdx.graphics.getBufferFormat().coverageSampling ? GL20.GL_COVERAGE_BUFFER_BIT_NV : 0)); Gdx.gl20.glClearColor(0.0f, 0.0f, 0.1f, 1.0f); universe.render(); pauseMenuBatch.begin(); if (paused) { pauseMenuBatch.draw( pauseBackground, 0, UltranautGame.HEIGHT / 2 - 200, UltranautGame.WIDTH, 400); pauseFont.draw( pauseMenuBatch, "Stasis", UltranautGame.WIDTH / 2 - new GlyphLayout(pauseFont, "Stasis").width / 2, UltranautGame.HEIGHT / 2 + 150); resume.draw(pauseMenuBatch); mainMenu.draw(pauseMenuBatch); exit.draw(pauseMenuBatch); } if (UltranautGame.debug) { pauseFont.draw( pauseMenuBatch, Gdx.graphics.getFramesPerSecond() + "fps", 5, Gdx.graphics.getHeight()); } pauseMenuBatch.end(); }
public void update(float dt) { // Handles pause menu logic if (Gdx.input.isKeyJustPressed(Keys.ESCAPE)) paused = !paused; // If the pause menu isn't showing, make everything else tick if (!paused) { universe.update(dt); } else { resume.update(dt); mainMenu.update(dt); exit.update(dt); } }