|
Project Ghost Code Demo |
||
|
|
||
| This applet demonstrates the PaintManager & RectangleManager classes I had to write to support background refresh at about 30FPS with at least 20 sprites. The idea is that whenever anything paints on the background, the "dirty" rectangle gets pushed into the RectangleManager which compares the rectangle against the list of existing "dirty" rectangles. Whenever other rectangles are bigger/smaller or intersect with the newly added rectangle, the Manager attempts to unify the rectangles thus making the list smaller. Once the frame is done drawing itself, and the next frame is preparing for the scene to be drawn, the list of "dirty" rectangles can be dealt with by refreshing every rectangle on the list from the background image. This guarantees that I will not need to copy the entire background unless there are too many sprites moving on the screen. | ||