David, first i wanted to say thanks. It sounds awful, but i spent 6 hours today looking for working code that shows an applet using BufferStrategy. i was begining to think it was impossible. So i was happy when i found this post
Now here's the problem - i don't exactly understand the code and i don't know how to use it. And it won't compile for me. Am i doing something wrong?
My biggest two questions:
1. How do things get drawn?
In normal applets, you call one of the repaint() methods which calls update() which clears the invalidated region then calls paint()
But AppletGameCore doesn't have a repaint() or paint() method (you can not have a paint method?). And it has two update methods. It took me a while to realize that update(Graphics2D g) never gets called by the system. Because of the name i thought it was like update(), but it isn't, it just has the same name
So my best guess here is that you've completely disabled Java's drawing/painting and have chosen to handle it entirely manually. Is that correct?
If so, out of curiosity, why is the paint routine named draw() rather than paint()? Would it have confused the system if it had been called paint()?
2. Does the code compile?
My compiler (Sun's J2SE 1.4.2) doesn't like the method
public Graphics2D getGraphics()
That's because java.awt.Component already has a method called getGraphics() but it returns a Graphics rather than a Graphics2D. And since you can't have two methods that are identical except for return type...
i really, really want this code to work, but i've been screwing with it for a while and i can't figure out how to do it. Help?