world
Class VoidWorld

A Class representing an imperative World and the related methods
for drawing the world and handling various events. In order to
implement a functioning World you must extend this class,
and implement an onDraw method.
Other handler methods (tickRate,
onTick, onMouse, onKey, onRelease, stopWhen, and lastScene) are optional, and can be
overridden to add new functionality.

See the individual
methods for detailed documentation.

Extending VoidWorld

Below is a simple example of a VoidWorld that adds a
new point at each mouse click. The world contains a Scene and a new Circle is placed
for each "button-down" event received.

tickRate

Return the tick rate for this VoidWorld in seconds. For example,
0.5 means two ticks per second. The
rate is only accessed when bigBang() is initially called and the
window is created.

onTick

public void onTick()

Change this VoidWorld based on the Tick of the clock. This
method is called to update the VoidWorld on each clock tick.

onMouse

public void onMouse(int x,
int y,
java.lang.String event)

Change this VoidWorld when a mouse event is triggered.
x and y are the location of the event in the window, and
event is a String that describes what kind of event
occurred.

Possible Mouse Events

"button-down" :

The user presses a mouse button in the VoidWorld window

"button-up" :

The user releases a mouse button in the VoidWorld window

"move" :

The user moves the mouse in the VoidWorld window

"drag" :

The user holds a mouse button and moves the mouse in the VoidWorld window

"enter" :

The user moves the mouse in-to the VoidWorld window

"leave" :

The user moves the mouse out-of the VoidWorld window

onKey

public void onKey(java.lang.String event)

Change this VoidWorld when a key event is
triggered. The given event is a String that
describes which key was pressed.

Special Key

"up" :

The user presses the up-arrow key

"down" :

The user presses the down-arrow key

"left" :

The user presses the left-arrow key

"right" :

The user presses the right-arrow key

Other keys generate a single character String that
represents the key pressed. For example, Pressing the B key on
the keyboard generates "b" as an event.
If the shift key is held while pressing B then "B" is generated.

onRelease

public void onRelease(java.lang.String event)

Change this VoidWorld when a key is released. The given event
is a String that describes which key was released.

Special Keys

"up" :

The user presses the up-arrow key

"down" :

The user presses the down-arrow key

"left" :

The user presses the left-arrow key

"right" :

The user presses the right-arrow key

Other keys generate a single character String that
represents the key released. For example, Pressing then releasing the B key on
the keyboard generates "b" as an onKey event and again
as an onRelease event. If the shift key is held while pressing/releasing B then "B" is generated.

stopWhen

public boolean stopWhen()

Determine if the World/interaction/animation should be
stopped. Returning a value of true
discontinues all events (mouse, key, ticks) and causes lastScene() to be used to draw the final
Scene.