[s]With, Java2D, I did like this:
@Override
public void draw(Graphics2D g)
{
AffineTransform transformer = new AffineTransform();
transformer.translate(-(Math.min(stage.width-stage.visibleWidth, Math.max(0, main.posX - stage.visibleWidth / 2))),
-(Math.min(stage.height-stage.visibleHeight, Math.max(0, main.posY - stage.visibleHeight / 2))));
g.setTransform(transformer);
//...
}
This works perfect.
I tried similar in Slick2D:
@Override
public void render(GameContainer gc, Graphics g) throws SlickException
{
g.translate(-(Math.min(stage.width-stage.visibleWidth, Math.max(0, main.posX - stage.visibleWidth / 2))),
-(Math.min(stage.height-stage.visibleHeight, Math.max(0, main.posY - stage.visibleHeight / 2))));
//...
}
This however, did not work at all. The result was that every thing in the window was black.
How do I fix this?[/s]
EDIT: This was an mistake by me. translate works fine for slick2d