Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## simogl.level
Class AbstractLevel

    java.lang.Object
      simogl.level.AbstractLevel

Direct Known Subclasses:
  DemoLevel

    public abstract class AbstractLevel

extends java.lang.Object

This class represents a world (level)

Author:
  Frank Bruns

Field Summary
`static java.util.ArrayList<AbstractGameObject>` | `buildings`
`static java.util.ArrayList<AbstractGameObject>` | `characters`
`Fog` | `fog`
`static Food` | `food`
`static Gold` | `gold`
`static java.util.ArrayList<Light>` | `lights`
`static java.util.ArrayList<AbstractParticleEffect>` | `partEffects`
`static java.util.ArrayList<Rain>` | `rainSources`
`SkyBox` | `skyBox`
`static Terrain` | `terrain`
`static MeshDL` | `waterLayer`
`static java.util.ArrayList<AbstractMesh>` | `worldItemsSolid`
`static java.util.ArrayList<AbstractMesh>` | `worldItemsTransparent`

Constructor Summary
`AbstractLevel(javax.media.opengl.GL gl, int amountGold, int amountFood)` Creates a new level with the specified initial values for gold and food for the player

Method Summary
`void` | `createRain(int mapSize, int distance)` Call this method, if you would like to add a rain effect to your level.
`void` | `createSkybox(javax.media.opengl.GL gl, java.lang.String north, java.lang.String south, java.lang.String east, java.lang.String west, java.lang.String top, java.lang.String bottom)` This method must be called to create the world's skybox
`void` | `createTerrain(javax.media.opengl.GL gl, java.lang.String mapPath, int size, int resolution, com.sun.opengl.util.texture.Texture texture)` Call this method to create the world's terrain from a heightmap file.
`abstract void` | `createTextures()` This method must be overridden to initialize the textures for the concrete world.
`void` | `createWaterLayer(javax.media.opengl.GL gl, int size, float yPos, com.sun.opengl.util.texture.Texture texture)` This method must be called to create the water layer of the world.
`abstract void` | `createWorldContent(javax.media.opengl.GL gl)` This is the central method that should be used to create all world content.
`void` | `draw(javax.media.opengl.GL gl, long elapsedTime)` Draws the world to the screen
`static boolean` | `isEnabledRain()` Static method that determines whether the rain effect is enabled or disabled
`static void` | `setEnabledRain(boolean enableRain)` Static method to enable or disable the rain effect of the level

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### characters

    public static java.util.ArrayList<AbstractGameObject> characters

### buildings

    public static java.util.ArrayList<AbstractGameObject> buildings

### worldItemsSolid

    public static java.util.ArrayList<AbstractMesh> worldItemsSolid

### worldItemsTransparent

    public static java.util.ArrayList<AbstractMesh> worldItemsTransparent

### partEffects

    public static java.util.ArrayList<AbstractParticleEffect> partEffects

### rainSources

    public static java.util.ArrayList<Rain> rainSources

### lights

    public static java.util.ArrayList<Light> lights

### gold

    public static Gold gold

### food

    public static Food food

### fog

    public Fog fog

### skyBox

    public SkyBox skyBox

### terrain

    public static Terrain terrain

### waterLayer

    public static MeshDL waterLayer

Constructor Detail

### AbstractLevel

    public AbstractLevel(javax.media.opengl.GL gl,
                         int amountGold,
                         int amountFood)

  Creates a new level with the specified initial values for gold and food for the player

  Parameters:
    `gl` -
    `amountGold` - initial amount of gold for the player
    `amountFood` - initial amount of food for the player

Method Detail

### createWorldContent

    public abstract void createWorldContent(javax.media.opengl.GL gl)

  This is the central method that should be used to create all world content. This is the place where the world objects that have been defined as global class variables can be instaciated. Some world items that usually appear in every scene can be created by convinience methods, such as createSkybox(), createTerrain(), createWaterLayer()

  Parameters:
    `gl` -

### createTextures

    public abstract void createTextures()

  This method must be overridden to initialize the textures for the concrete world. The texture objects have to be global class variables, that can be similarily instanciated like this in your overridden createTextures()-method :
  `this.texWall = TextureIO.newTexture(rsLoader.getFile("./textures/wall.png"), true);
  this.texSand = TextureIO.newTexture(rsLoader.getFile("./textures/sand.png"), true);`
  You will have to put a try-catch-block around the code in order to handle IOExceptions

### createSkybox

    public void createSkybox(javax.media.opengl.GL gl,
                             java.lang.String north,
                             java.lang.String south,
                             java.lang.String east,
                             java.lang.String west,
                             java.lang.String top,
                             java.lang.String bottom)

  This method must be called to create the world's skybox

  Parameters:
    `gl` -
    `north` - filepath+filename for northern texture
    `south` - filepath+filename for southern texture
    `east` - filepath+filename for eastern texture
    `west` - filepath+filename for western texture
    `top` - filepath+filename for top texture
    `bottom` - filepath+filename for bottom texture

### createTerrain

    public void createTerrain(javax.media.opengl.GL gl,
                              java.lang.String mapPath,
                              int size,
                              int resolution,
                              com.sun.opengl.util.texture.Texture texture)

  Call this method to create the world's terrain from a heightmap file.

  Parameters:
    `gl` -
    `mapPath` - path+filename to the height map file
    `size` - pixel width/height of the height map file
    `resolution` - resolution factor for parsing the height map file
    `texture` - the texture that ought to be wrapped over the terrain

### createRain

    public void createRain(int mapSize,
                           int distance)

  Call this method, if you would like to add a rain effect to your level. The distance parameter is used to specifiy the distance between different rain sources. The higher the distance, the less the number of rain sources that get spread over the map, hence a better performance

  Parameters:
    `mapSize` - size of the level's height map
    `distance` - distance between the rain sources

### createWaterLayer

    public void createWaterLayer(javax.media.opengl.GL gl,
                                 int size,
                                 float yPos,
                                 com.sun.opengl.util.texture.Texture texture)

  This method must be called to create the water layer of the world.

  Parameters:
    `gl` -
    `size` - width/length of the water layer. Should be the same size as the terrain's height map pixel width/height
    `yPos` - defines the sea level, i.e. the height level of the water surface
    `texture` - a texture that ought to be wrapped onto the water surface

### setEnabledRain

    public static void setEnabledRain(boolean enableRain)

  Static method to enable or disable the rain effect of the level

  Parameters:
    `enableRain` - enable rain? --> true=yes, false=no

### isEnabledRain

    public static boolean isEnabledRain()

  Static method that determines whether the rain effect is enabled or disabled

  Returns:
    is rain enabled? --> true=yes, false=no

### draw

    public void draw(javax.media.opengl.GL gl,
                     long elapsedTime)

  Draws the world to the screen

  Parameters:
    `gl` -
    `elapsedTime` - time between two frames

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD