how to properly link an OrthographicCamera to a OrthogonalTiledMapRenderer
How do I properly link an OrthographicCamera to a OrthogonalTiledMapRenderer? I have tiled map i'd like render and two stages that have actors on them.. I call render.render() in my screens render method as well as stages.draw(); but every i put render.setView(camera) the screen displayed flashes or does other weird things. How do I properly attach a moveable camera to a tiled map renderer? I render the map first, do game logic and then call draw on the stages. when I call translate on the camera the tiled map zooms way out for some reason?
here is my render method
public void render(float delta) {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
renderer.render();
gameLogic();
backStage.act(); // acts are called but do nothing
frontStage.act();
frontStage.draw();
backStage.draw();
}
here is where the camera and renderer get created
public void addMap(GameMap map){
this.map=map;
maps.add(map);
renderer=new OrthogonalTiledMapRenderer(map.getTiledMap(), 1/20f);
camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
float aspect = Gdx.graphics.getWidth()/Gdx.graphics.getHeight();
camera.setToOrtho(false, 20*aspect, 20*aspect);
renderer.setView(camera);
frontStage= new Stage();
backStage=new Stage();
xSize=map.getXSize();
ySize=map.getYSize();
Gdx.input.setInputProcessor(this);
}
renderer.setView(camera);
in the render method so it will call every frame \$\endgroup\$