package gridworld;

import java.awt.Color;

import bwyap.gridgame.GridGameWindow;
import bwyap.gridgame.render.entity.Ellipse;
import bwyap.gridgame.render.entity.GridGameImage;
import bwyap.gridgame.render.entity.Mover;
import bwyap.gridgame.render.entity.Orbiter;
import bwyap.gridgame.render.entity.Rectangle;
import bwyap.gridgame.render.entity.RotationDirection;
import bwyap.gridgame.render.entity.Text;
import bwyap.gridgame.res.ResourceLoader;

/**
 * An extension of GridGameWindow which implements custom game functionality
 * @author bwyap
 *
 */
public class GridWorldDemoWindow extends GridGameWindow {

	private static final long serialVersionUID = -3347622854920719009L;
	
	private Orbiter o1;
	private Orbiter o2;
	private Orbiter o3;
	private Orbiter o4;
	private Mover m1;
	
	/**
	 * Create a GridWorldWindow and initialize the game state. <- TODO
	 * @param title
	 */
	public GridWorldDemoWindow(String title) {
		super(title);
	}
	
	/**
	 * Initialize test elements
	 */
	public void testInit() {
		// Create some text elements
		Text t1 = new Text("Title1", "Hello world!", 0, 0);
		t1.setSize(60);
		getCanvas().addDrawable(t1);

		Text t2 = new Text("Title2", "The quick brown fox jumps over the lazy dog", 5, 70);
		t2.setSize(14);
		getCanvas().addDrawable(t2);

		
		// Create orbiters
		Rectangle r = new Rectangle("r1", 150, 200, 30, 30);
		r.setColour(Color.RED);
		o1 = new Orbiter(r);
		o1.setRadius(100);
		o1.setSpeed(500);
		getCanvas().addDrawable(o1);
		
		Ellipse e = new Ellipse("r2", 350, 200, 30, 40);
		e.setColour(Color.GREEN);
		o2 = new Orbiter(e);
		o2.setRadius(80);
		o2.setSpeed(100);
		o2.setDirection(RotationDirection.ANTICLOCKWISE);
		getCanvas().addDrawable(o2);
		
		r = new Rectangle("r3", 550, 200, 30, 30);
		r.setColour(Color.BLUE);
		o3 = new Orbiter(r);
		o3.setRadius(120);
		o3.setSpeedX(500);
		o3.setSpeedY(300);
		getCanvas().addDrawable(o3);
		
		GridGameImage i1 = new GridGameImage("i1", 300, 400, 50, 50, ResourceLoader.getImage("ball"));
		o4 = new Orbiter(i1);
		o4.setSpeed(300);
		getCanvas().addDrawable(o4);
		
		
		// Create a move that responds to keyboard input
		GridGameImage i2 = new GridGameImage("i2", 1, 400, 500, 50, 50, ResourceLoader.getImage("ball"));
		m1 = new Mover(i2, input);
		getCanvas().addDrawable(m1);
	}
	
	@Override
	public void update(float timeElapsed) {
		// update objects
		//o1.update(timeElapsed);
		//o2.update(timeElapsed);
		//o3.update(timeElapsed);
		//o4.update(timeElapsed);
		m1.update(timeElapsed);
	}
	
}

@@ -526,16 +526,48 @@
 ionality
+.%0A * Demo of GridGame components
 %0A * @aut
@@ -2405,18 +2405,16 @@
 jects%0A%09%09
-//
 o1.updat
@@ -2431,18 +2431,16 @@
 sed);%0A%09%09
-//
 o2.updat
@@ -2457,18 +2457,16 @@
 sed);%0A%09%09
-//
 o3.updat
@@ -2483,18 +2483,16 @@
 sed);%0A%09%09
-//
 o4.updat

Update documentation