package bobby;

import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JApplet;

/**
 *
 * @author Kiarash Korki <kiarash96@users.sf.net>
 */
public class SceneManager extends Thread {
	
	private final JApplet parent;
	private ArrayList<SceneObject> list;
	
	public SceneManager(JApplet parent) {
		list = new ArrayList<>();
		this.parent = parent;
	}
	
	public void draw(Graphics g) {
		// TODO: implement double buffering
		for (SceneObject sobject : list)
			sobject.draw(g);
	}
	
	@Override
	public void run() {
		while (true)
			parent.repaint();
	}
	
	public void add(SceneObject so) {
		list.add(so);
	}
	
	public void remove(SceneObject so) {
		list.remove(so);
	}
	
}

@@ -11,16 +11,40 @@
 bby;%0D%0A%0D%0A
+import java.awt.Color;%0D%0A
 import j
@@ -481,16 +481,135 @@
 fering%0D%0A
+%09%09%0D%0A%09%09// clear the screen%0D%0A%09%09g.setColor(Color.WHITE);%0D%0A%09%09g.fillRect(0, 0, parent.getWidth(), parent.getHeight());%0D%0A%09%09%0D%0A
 %09%09for (S
@@ -653,24 +653,46 @@
 t.draw(g);%0D%0A
+%09%09%0D%0A%09%09// TODO: sleep%0D%0A
 %09%7D%0D%0A%09%0D%0A%09@Ove

Clear the screen before drawing