jme.world
Class World

java.lang.Object
  extended byjme.world.World

public class World
extends java.lang.Object

World maintains the game world, by handling the locale and list of entities. World takes care of updating all game items and the locale.

Version:
0.1.0
Author:
Mark Powell

Constructor Summary
World()
          Constructor builds a default World object that does not contain a locale nor any entities.
World(Locale locale)
          Constructor builds a World object with an initial Locale.
World(Locale locale, java.util.ArrayList entities)
          Constructor builds a World object with an initial Locale and entity list.
 
Method Summary
 void addEntity(EntityInterface entity)
          addEntity adds an entity to the entity list.
 int getNumRenderedEntities()
          getNumRenderedEntities returns the number of entities that were rendered this frame.
 int getTotalEntities()
          getTotalEntities returns the total number of entities within the world.
 void render()
          render renders the entities in turn and then the locale.
 void setCamera(Camera camera)
          setCamera sets the camera for the current world.
 void setEntityVisibility(boolean value)
           
 void setLocale(Locale locale)
          setLocale sets the locale of this world.
 void setWater(Water water)
          setWater sets the water representation of the terrain.
 java.lang.String toString()
          toString returns the string representation of this object in the format:

jme.world.World@11a64ed
Locale: {LOCALE}
Entities: {ENTITY}
 void update(float time)
          update updates the locale and any Entities that are within the entities list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

World

public World()
Constructor builds a default World object that does not contain a locale nor any entities.


World

public World(Locale locale)
Constructor builds a World object with an initial Locale.

Parameters:
locale - the game locale.
Throws:
MonkeyRuntimeException - if locale is null.

World

public World(Locale locale,
             java.util.ArrayList entities)
Constructor builds a World object with an initial Locale and entity list.

Parameters:
locale - the game locale.
entities - the list of game entities.
Throws:
MonkeyRuntimeException - if either locale or entities are null.
Method Detail

setLocale

public void setLocale(Locale locale)
setLocale sets the locale of this world.

Parameters:
locale - the game locale.
Throws:
MonkeyRuntimeException - if local is null.

setWater

public void setWater(Water water)
setWater sets the water representation of the terrain. This takes an Water subclass. The client is reponsible for calling the water's render method during the terrain's render call.


setCamera

public void setCamera(Camera camera)
setCamera sets the camera for the current world.

Parameters:
camera - the new camera.

setEntityVisibility

public void setEntityVisibility(boolean value)

addEntity

public void addEntity(EntityInterface entity)
addEntity adds an entity to the entity list.

Parameters:
entity - the entity to add to the list.
Throws:
MonkeyRuntimeException - if enitity is null.

getTotalEntities

public int getTotalEntities()
getTotalEntities returns the total number of entities within the world.

Returns:
the number of entities in the world.

getNumRenderedEntities

public int getNumRenderedEntities()
getNumRenderedEntities returns the number of entities that were rendered this frame.

Returns:
the number of rendered entities this frame.

update

public void update(float time)
update updates the locale and any Entities that are within the entities list.


render

public void render()
render renders the entities in turn and then the locale.


toString

public java.lang.String toString()
toString returns the string representation of this object in the format:

jme.world.World@11a64ed
Locale: {LOCALE}
Entities: {ENTITY}

Returns:
the string representation of this object.