I'm making a game as my project in school. I'm having a problem regarding double buffering, im trying to draw an image (drawImage(,,,,)) into the double buffered image, I can't seem to make it work help please =D
public void render() {
if(doubleBufferImage==null){
doubleBufferImage = createImage(PANEL_WIDTH,PANEL_HEIGHT); // Set Size
if(doubleBufferImage == null) { // checks the buffer again
System.out.println("doubleBufferedImage is null");
return;
}
else
doubleBufferG = doubleBufferImage.getGraphics();
}
doubleBufferG.setColor(Color.BLACK);
doubleBufferG.fillRect (0, 0, PANEL_WIDTH, PANEL_HEIGHT);
// display FPS
doubleBufferG.setColor(Color.RED);
doubleBufferG.drawString("FPS:" + FPS , 1 , 10);
//doubleBufferG.drawImage(image1,400,400,this); // THIS WOULD NOT WORK
}