de.unifreiburg.twodeedoo.world
Class WorldApplication

java.lang.Object
  extended by de.unifreiburg.twodeedoo.world.WorldApplication
All Implemented Interfaces:
java.lang.Runnable

public class WorldApplication
extends java.lang.Object
implements java.lang.Runnable

Application which runs one IWorld.

Simplest way of using this class: call static method runWorld(IWorld) with an instance of your world. That will open a window of the right size and run the simulation until your world calls quit.


Constructor Summary
WorldApplication(IWorld world)
          Create an application to run one world.
 
Method Summary
 void init()
          All one-time initializations, all begin-of-game initializations
 void run()
          This will be the first method to be run.
static void runWorld(IWorld world)
          Friendly all-in-one service to run a world: create a window, simulate the world etc.
 void startPlaying()
          Start interacting with the game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorldApplication

public WorldApplication(IWorld world)
Create an application to run one world.

Parameters:
world - the world to be run.
Method Detail

startPlaying

public void startPlaying()
Start interacting with the game. Requires full initialization.


init

public void init()
          throws java.io.IOException
All one-time initializations, all begin-of-game initializations

Throws:
java.io.IOException - picture loading failure.

run

public void run()
This will be the first method to be run. Call this on the GUI thread, not on the main thread!

Specified by:
run in interface java.lang.Runnable

runWorld

public static void runWorld(IWorld world)
Friendly all-in-one service to run a world: create a window, simulate the world etc.

Parameters:
world - some world.