@Override public void resize(int width, int height) { // camera.getPlayerCamera().setToOrtho(false, (Gdx.graphics.getWidth() / Gdx.graphics.getPpiX()) // * 2, (Gdx.graphics.getHeight() / Gdx.graphics.getPpiY() )* 2 ); // camera.getBackgroundCamera().setToOrtho(false, (Gdx.graphics.getWidth() / // Gdx.graphics.getPpiX()) * 2, (Gdx.graphics.getHeight() / Gdx.graphics.getPpiY())* 2 ); // camera.getMiddlegroundCamera().setToOrtho(false, (Gdx.graphics.getWidth() / // Gdx.graphics.getPpiX()) , (Gdx.graphics.getHeight() / Gdx.graphics.getPpiY()) ); camera.getHudStage().getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera .getGameOverStage() .getViewport() .update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); }
@Override public void render(float delta) { // Reinigt Bildschirm Gdx.gl.glClearColor(0.9f, 0.1f, 0.1f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Aktualisiert Logik worldLoader.getRenderer().setView(camera.getPlayerCamera()); worldLoader.updateWorld(delta); // Rendert alle Objeckte innerhalb des batchs game.getBatch().begin(); game.getBatch().setProjectionMatrix(camera.getBackgroundCamera().combined); game.getBatch() .draw( gameBackground, -15, -10, gameBackground.getWidth() / 40, gameBackground.getHeight() / 30); game.getBatch() .draw( gameBackground, -15 + gameBackground.getWidth() / 40, -10, gameBackground.getWidth() / 40, gameBackground.getHeight() / 30, 0, 0, gameBackground.getWidth(), gameBackground.getHeight(), true, false); if (gameMiddleground != null) { game.getBatch().setProjectionMatrix(camera.getMiddlegroundCamera().combined); game.getBatch() .draw( gameMiddleground, -15, -10, gameBackground.getWidth() / 40, gameBackground.getHeight() / 30); game.getBatch() .draw( gameMiddleground, -15 + gameBackground.getWidth() / 40, -10f, gameBackground.getWidth() / 40, gameBackground.getHeight() / 30, 0, 0, gameBackground.getWidth(), gameBackground.getHeight(), true, false); } game.getBatch().end(); camera.update(delta); // Rendert tmx map game.getBatch().setProjectionMatrix(camera.getPlayerCamera().combined); worldLoader.renderMap(game.getBatch()); // Rendert Physik-Debug Texturen // debugRenderer.render(worldLoader.getWorld(), camera.getPlayerCamera().combined); if (showGameOverScreen == true) { // camera.getGameOverStage().getBatch().setColor(Color.RED); game.getBatch().begin(); game.getBatch().setColor(0.9f, 0.1f, 0.1f, 0.6f); /* game.getBatch().draw(game.getAssets().getWhiteColor(),0,0,Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); */ game.getBatch().end(); camera.getGameOverStage().draw(); } else if (showMenuScreen == true) { camera.getMenuStage().draw(); } else if (showGameEndScreen == true) { camera.getGameEndStage().draw(); } else { camera.render(game.getBatch()); } }