I am building a simple game rendering method. I have a static images like map background that isn't really changing at all . I am just using like 30% of the whole screen for changing graphics. And I don't feel like it is necessary to render all that stuff over and over again if it isn't changing..
on internet I found something about passive rendering - You draw what you need and wait... until something updates .. after that you update it and again wait. Looks like a great method for this situation . But now ... I have a render method like that :
public class X extends Canvas{
//some method
this.createBufferStrategy(3);
//....
public void render(){
BufferStrategy buffer = this.getBufferStrategy();
Graphics g = buffer.getDrawGraphics();
//Draws black background...
g.setColor(Color.BLACK);
g.fillRect(....
for(... //cycles every object and calls their render methods...
}
This is unable to maintain draw and wait method...becouse the background is redrawn every 1/30 of second so If you don't have anything to draw, you get black canvas with nothing on it.. so you have to always redraw everything each update...If I don't draw the background , buffer start to blink like hell... so I have to have something to cover that stuff up.
I searched on internet and found nothing much about other solutions for this rendering type.. Tuns of stuff for active rendering but nothing for that Draw and wait method..
I think it's impossible to do that with BufferStrategy. Is there something else to serve for this ? Also is there other source for Graphics g ? On internet was something about calling it directyl from Canvas but I didn't get it running for this. Or am I thinking about it from wrong angle?