| Imperative Drawing Library: idraw.jar | |||||||||||||||||
The The Javadocs for the idraw library.
/**
* World for programming interactive games - with graphics, key events,
* and a timer.
*/
abstract public class World{
/** the canvas that displays the current world */
protected Canvas theCanvas;
/** The default constructor.
* To start the world one must invoke the bigBang method. */
public World(){ }
/** Start the world by creating a canvas of the given size
* and starting the timer at the given speed. */
public void bigBang(int w, int h, double speed);
/** End the world clock and key events:
* display the given message. */
public void endOfTime(String s);
/** End the world interactions: display the given message. */
public void endOfWorld(String s);
/** Change the World to what it should look like after a clock tick. */
abstract public void onTick();
/** Change the World to what it should look like
* in response to the given key input. */
abstract public void onKeyEvent(String s);
/** Draw this world in 'theCanvas'. */
abstract public void draw();
}
To run the game invoke its
public static void main(String[] argv){
// user defines the starting world
World w = new MyWorld(...);
// user supplies the world size and clock speed
w.bigBang(...width..., ...height..., ...speed...);
}
Here is a complete code for a running program called BlobWorld.java | ||||||||||||||||||
| last updated on Fri Apr 1 14:26:43 EDT 2011 | generated with DrRacket |