@Override public void render() { viewport.apply(); Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.setProjectionMatrix(viewport.getCamera().combined); batch.begin(); renderTextureCentered(batch, nearest, viewport.getWorldWidth() * 1.5f / 6, viewport.getWorldHeight() * 1 / 2, SCALE); renderTextureCentered(batch, nearest, viewport.getWorldWidth() * 3 / 6, viewport.getWorldHeight() * 1 / 2, 1.0f); renderTextureCentered(batch, linear, viewport.getWorldWidth() * 4.5f / 6, viewport.getWorldHeight() * 1 / 2, SCALE); batch.end(); }
@Override public void render(float delta) { viewport.apply(); Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.setProjectionMatrix(viewport.getCamera().combined); batch.begin(); font.draw(batch, "Hello from " + this.getClass().getSimpleName(), viewport.getWorldWidth() / 2, viewport.getWorldHeight() / 2, 0, Align.center, false); batch.end(); }
font.draw(batch, message, 40, textViewport.getWorldHeight() - 40); batch.end();
font.draw(batch, message, 40, textViewport.getWorldHeight() - 40); batch.end();
@Override public void render(float delta) { // TODO: Apply the viewport viewport.apply(); // TODO: Set the clear color Gdx.gl.glClearColor(0, 0, 0, 1); // TODO: Clear the color buffer Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT); // TODO: Set the SpriteBatch's projection matrix batch.setProjectionMatrix(viewport.getCamera().combined); // TODO: Begin a new batch batch.begin(); // TODO: Use delta to figure out the number of frames per second float fps = 1 / delta; // TODO: Use the BitmapFont to draw the FPS font.draw(batch, "FPS = " + fps, viewport.getWorldWidth() / 4, viewport.getWorldHeight() / 2); // TODO: End the batch batch.end(); } }