| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuniverse.world.VoidWorld<Msg>
public abstract class VoidWorld<Msg extends java.io.Serializable>
A Class representing an imperative World and the related methods
  for drawing the world and handling various events connected to a
  Universe.  The class is parameterized by
  the type of messages (which must extend
  Serializable) that are passed
  throughout the Universe.
    
 
 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. 
 Most handler methods return a VoidPackage, which contains a possible message to the connected
  Universe.  In order to interact with the
  Universe and other VoidWorld/Worlds,
  implementations must override the onReceive method that handles
  messages from the Universe.  
  See also world.VoidWorld for similar documentation on individual methods.
 
| Field Summary | |
|---|---|
| static double | DEFAULT_TICK_RATEDefault Tick rate for the world: ~33 frames per second | 
| static java.lang.String | KEY_ARROW_DOWNKey arrow-down event String | 
| static java.lang.String | KEY_ARROW_LEFTKey arrow-left event String | 
| static java.lang.String | KEY_ARROW_RIGHTKey arrow-right event String | 
| static java.lang.String | KEY_ARROW_UPKey arrow-up event String | 
| static java.lang.String | MOUSE_DOWNMouse down (button-down) event String | 
| static java.lang.String | MOUSE_DRAGMouse down & move (drag) event String | 
| static java.lang.String | MOUSE_ENTERMouse window enter (enter) event String | 
| static java.lang.String | MOUSE_LEAVEMouse window leave (leave) event String | 
| static java.lang.String | MOUSE_MOVEMouse motion (move) event String | 
| static java.lang.String | MOUSE_UPMouse up (button-up) event String | 
| Constructor Summary | |
|---|---|
| VoidWorld() | |
| Method Summary | |
|---|---|
|  VoidWorld<Msg> | bigBang()Kick off the interaction/animation without connecting to the Universe. | 
|  VoidWorld<Msg> | bigBang(java.lang.String server,
        java.lang.String name)Kick off the interaction/animation and connect to the given Universe server URL, under the given client name. | 
|  Scene | lastScene()Returns the Scene that should be displayed when the interaction/animation completes ( stopWhen()returns true). | 
| abstract  Scene | onDraw()Return a visualization of this VoidWorld as a Scene. | 
|  VoidPackage<Msg> | onKey(java.lang.String ke)Change this VoidWorld (and produce a VoidPackage possibly containing a message) when a key event is triggered. | 
|  VoidPackage<Msg> | onMouse(int x,
        int y,
        java.lang.String me)Change this VoidWorld (and produce a VoidPackage possibly containing a message) when a mouse event is triggered. | 
|  VoidPackage<Msg> | onReceive(Msg msg)Change this VoidWorld (and produce a VoidPackage possibly containing a message) when a message from the universe is received. | 
|  VoidPackage<Msg> | onRelease(java.lang.String ke)Change this VoidWorld (and produce a VoidPackage possibly containing a message) when a key is released. | 
|  VoidPackage<Msg> | onTick()Change this VoidWorld based on the Tick of the clock. | 
|  boolean | stopWhen()Determine if the World/interaction/animation should be stopped. | 
|  double | tickRate()Return the tick rate for this VoidWorld in seconds. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static double DEFAULT_TICK_RATE
public static java.lang.String MOUSE_DOWN
public static java.lang.String MOUSE_UP
public static java.lang.String MOUSE_ENTER
public static java.lang.String MOUSE_LEAVE
public static java.lang.String MOUSE_MOVE
public static java.lang.String MOUSE_DRAG
public static java.lang.String KEY_ARROW_UP
public static java.lang.String KEY_ARROW_DOWN
public static java.lang.String KEY_ARROW_LEFT
public static java.lang.String KEY_ARROW_RIGHT
| Constructor Detail | 
|---|
public VoidWorld()
| Method Detail | 
|---|
public abstract Scene onDraw()
Scene.
    See EmptyScene, Scene.placeImage(Image, int, int), and
    Scene.addLine(int, int, int, int, String) for documentation on
    constructing Scenes
public double tickRate()
public VoidPackage<Msg> onTick()
public VoidPackage<Msg> onMouse(int x,
                                int y,
                                java.lang.String me)
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 | 
public VoidPackage<Msg> onKey(java.lang.String ke)
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 | 
public VoidPackage<Msg> onRelease(java.lang.String ke)
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 | 
public VoidPackage<Msg> onReceive(Msg msg)
public boolean stopWhen()
lastScene() to be used to draw the final
 Scene.
public Scene lastScene()
stopWhen()
 returns true).
public VoidWorld<Msg> bigBang(java.lang.String server,
                              java.lang.String name)
public VoidWorld<Msg> bigBang()
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||