public RetroSceneScreen() { screenViewport = new SceneFitViewport(); worldViewport = new Viewport() { // This is the World Viewport. It is like a ScreenViewport but the // camera is the same that the screenViewport; @Override public void apply(boolean centerCamera) { HdpiUtils.glViewport(getScreenX(), getScreenY(), getScreenWidth(), getScreenHeight()); getCamera().viewportWidth = getScreenWidth(); getCamera().viewportHeight = getScreenHeight(); if (centerCamera) getCamera().position.set(getScreenWidth() / 2, getScreenHeight() / 2, 0); getCamera().update(); } }; worldViewport.setCamera(screenViewport.getCamera()); }
public void draw() { // Draw a background and border. SpaceTravels3.shapeRenderer.setProjectionMatrix(this.backgroundProjectionMatrix); drawBackground(); SpaceTravels3.shapeRenderer.setProjectionMatrix(this.orthographicCamera.combined); Gdx.gl20.glEnable(GL20.GL_SCISSOR_TEST); // Crop out everything outside of the minimap (note the +1 to include the last pixel) HdpiUtils.glScissor( 0, 0, SCISSOR_WIDTH, SCISSOR_HEIGHT); if (this.shipProjection != null) { this.shipProjection.draw(); } for (GameEntity gameEntity : GameEntityManager.getGameEntities()) { gameEntity.miniMapGraphicComponent.draw(); } Gdx.gl20.glDisable(GL20.GL_SCISSOR_TEST); }
@Override public void apply(boolean centerCamera) { HdpiUtils.glViewport(getScreenX(), getScreenY(), getScreenWidth(), getScreenHeight()); getCamera().viewportWidth = getScreenWidth(); getCamera().viewportHeight = getScreenHeight(); if (centerCamera) getCamera().position.set(getScreenWidth() / 2, getScreenHeight() / 2, 0); getCamera().update(); }
@Override public void apply (boolean centerCamera) { HdpiUtils.glViewport(getScreenX(), getScreenY(), getScreenWidth(), getScreenHeight()); getCamera().viewportWidth = getScreenWidth(); getCamera().viewportHeight = getScreenHeight(); if (centerCamera) getCamera().position.set(getScreenWidth() / 2, getScreenHeight() / 2, 0); getCamera().update(); }
protected void begin(Viewport viewport) { fbo.begin(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); HdpiUtils.glViewport(viewport.getScreenX(), viewport.getScreenY(), viewport.getScreenWidth(), viewport.getScreenHeight()); }