A few questions about using buffer strategy. The answers are probably really obvious if you’re used to it, but I’m only learning so give me a chance.
For example:
// Render loop
while (!done) {
Graphics g = strategy.getDrawGraphics();
// Draw to graphics
... strategy.show();
}
- What exactly is happening here? Is the screen being drawn to constantly, as fast as the computer can handle, as opposed to
{What I’ve been doing since I’ve started using Java)
public void run(){
while (true){
updateProgram();
repaint();
try{
Thread.sleep(100);
}catch(InterruptedException e){}
}
}
- Where do you place the updateProgram() method when using buffer strategy, in the render loorp?
- And when will done ever be false in the rendering loop? Is the rendering loop supposed to be implemented in a seperate thread?
- One more thing, I take it that the drawing is being done direct to the JFrame as opposed to using JPanels?
Hope someone can help me out, I want to start putting some games in full screen mode and getting smoother animation.
Thanks.