Hi,
I had some flickering in my game, so I made a double buffer. For the game I use a custom Form.
It has an Image offscreen and a Thread that calls offPaint() up to 60 times per second.
In the paint() method it calls g.drawImage(offscreenImage, 0, 0);
The offPaint() method works like this:
public void offPaint() {
Image offscreenImage2 = Image.createImage(getWidth(), getHeight());
if (offscreenImage2 != null) {
Graphics g = offscreenImage2.getGraphics();
//draw things with g
offscreenImage = offscreenImage2;
}
}
In a JavaSE game I was able to get rid of the flickering with this.
In CN1 there are no freezes or errors, but there still is flickering. (tested on the Simulator and j2me)
Can you help me? Or is there a different, better way to prevent flickering?
Thanks in advance, Matthias Bay