BufferedImage Double Buffering?
I have succesfully made the buffered image, but I still get horrible flicking in my game. I also think I'm having a memory leakage, because I haven't properly done this. Everything looks basically like in any examples, but how wrong it is. Flickering is awful.
this is how I set up the BufferedImage, so basically I'm passing it to engine.
GraphicsEnvironment env =GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = env.getDefaultScreenDevice();
gameFrame game =new gameFrame();
screenManager gameScreen =new screenManager(device, game);
engineManager engine =new engineManager(game);
engine.start();
KeyListener keyInput =new inputManager();
MouseListener mouseListener =new inputManager();
MouseMotionListener mouseTracker =new inputManager();
game.createBufferStrategy(2);
game.addKeyListener(keyInput);
game.addMouseMotionListener(mouseTracker);
game.addMouseListener(mouseListener);
game.setIgnoreRepaint(true);
then at engineManager
public engineManager(Frame f){
bufferStrategy = f.getBufferStrategy();
g = (Graphics2D)bufferStrategy.getDrawGraphics();
}
and at render
publicvoid render(Graphics2D g){
Rectangle2D.Double rect =new Rectangle2D.Double(352F, 252F, 48F, 48F);
g.setColor(Color.white);
AffineTransform t =new AffineTransform();
//t.rotate(java.lang.Math.PI/180*x);
t.rotate(inputManager.rotateAngle, 376, 276);
g.setTransform(t);
g.clearRect(0,0,800,600);
g.fill(rect);
bufferStrategy.show();
I call the render at engineManager.run()
I thought the engine manager handles the double buffering for you? Do I have to make still make DB? If not what is wrong?

