JavaLib
 
WorldLib
 
draw
idraw
adraw
colors
 
Samples
 
Sources
Downloads
 
TSRJ Home
TSRJ Local

World Drawing Library

The World libraries provide a simple environmet for designing graphics-based interactive games. The novice programmer focuses on the design of the behavior of the game objects, the changes in the world in response to key events and clock generated tick events. The libraries provide a Canvas for drawing simple shapes and event handlers that process the onKeyEvent and onTick methods and redraw the scene by invoking the user-defined draw method.

There are three versions of the World libraries:

The novice programmer typically starts with the funcional (mutation-free) version draw library and produces the representation of the next scene in the game for each tick or each key event. The design of tests for this version is the least challenging.

The idraw version is designed in imperative style. The programmer changes the state of the world in response to the tick and key events. Typically, the programs become a bit less cluttered, but the testing is more challenging.

To convert a program from Java application to a Java applet requires just one boilerplate class that defines the initial state of the World and the size of the Canvas and a simple editing of the applet html file. The adraw library does the rest.

All three libraries refer to two simple libraries: colors that supplies the eight basic color choices for the drawings, and geometry that defines the class that represents a geometric location.


last updated on Fri Apr 1 14:26:43 EDT 2011generated with DrRacket