com.huguesjohnson.tiamat.graphics
Class Layer

java.lang.Object
  extended by com.huguesjohnson.tiamat.graphics.Layer

public class Layer
extends java.lang.Object

class Layer - a layer (or plane) that contains drawable items

Author:
Hugues Johnson

Field Summary
static int DEFAULT_LAYER_TYPE
          Default layer type.
static int TYPE_DIALOG
          A layer where dialogs are displayed.
static int TYPE_MAP
          A layer with a map associated to it.
static int TYPE_SPRITE
          A layer where sprites move.
 
Constructor Summary
Layer()
          Creates new instance of Layer, uses DEFAULT_LAYER_TYPE.
Layer(int type)
          Creates new instance of Layer.
Layer(java.lang.String mapPath, Formatter formatter)
          Creates new instance of Layer, uses TYPE_MAP.
 
Method Summary
 Map getMap()
          Returns the Map associated with this Layer.
 java.lang.String getMapPath()
          Returns the relative path to the file where the Map is saved.
 java.lang.String getMapPathAbsolute()
          Returns the absolute path to the file where the Map is saved.
 int getType()
          Returns what type of layer this is, see TYPE constants.
 Map loadMap(Formatter formatter)
          Loads the Map into memory and return it.
 void setAbsoluteDir(java.lang.String absoluteDir)
          Sets the absolute path to the directory where the Map is saved.
 void setMapPath(java.lang.String mapPath, Formatter formatter)
          Sets the relative path to the file where the Map is saved.
 void setType(int type)
          Sets what type of layer this is, see TYPE constants.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_MAP

public static final int TYPE_MAP
A layer with a map associated to it.

See Also:
Constant Field Values

TYPE_SPRITE

public static final int TYPE_SPRITE
A layer where sprites move.

See Also:
Constant Field Values

TYPE_DIALOG

public static final int TYPE_DIALOG
A layer where dialogs are displayed.

See Also:
Constant Field Values

DEFAULT_LAYER_TYPE

public static final int DEFAULT_LAYER_TYPE
Default layer type.

See Also:
Constant Field Values
Constructor Detail

Layer

public Layer()
Creates new instance of Layer, uses DEFAULT_LAYER_TYPE.


Layer

public Layer(int type)
Creates new instance of Layer.

Parameters:
type - What type of layer this is, see TYPE constants.

Layer

public Layer(java.lang.String mapPath,
             Formatter formatter)
Creates new instance of Layer, uses TYPE_MAP.

Parameters:
mapPath - The relative path to the file where the Map is saved.
formatter - The Formatter used to deserialize the Map.
Method Detail

getType

public int getType()
Returns what type of layer this is, see TYPE constants.

Returns:
What type of layer this is, see TYPE constants.

setType

public void setType(int type)
Sets what type of layer this is, see TYPE constants.

Parameters:
type - What type of layer this is, see TYPE constants.

getMap

public Map getMap()
Returns the Map associated with this Layer. Should be null unless type==MAP, change by setting the map path.

Returns:
The Map associated with this Layer.

loadMap

public Map loadMap(Formatter formatter)
Loads the Map into memory and return it.

Parameters:
formatter - The Formatter used to deserialize the Map.
Returns:
The Map that was loaded.

getMapPath

public java.lang.String getMapPath()
Returns the relative path to the file where the Map is saved.

Returns:
The relative path to the file where the Map is saved.

getMapPathAbsolute

public java.lang.String getMapPathAbsolute()
Returns the absolute path to the file where the Map is saved.

Returns:
The absolute path to the file where the Map is saved.

setMapPath

public void setMapPath(java.lang.String mapPath,
                       Formatter formatter)
Sets the relative path to the file where the Map is saved.

Parameters:
mapPath - The relative path to the file where the Map is saved.
formatter - The Formatter used to deserialize the Map.

setAbsoluteDir

public void setAbsoluteDir(java.lang.String absoluteDir)
Sets the absolute path to the directory where the Map is saved.

Parameters:
absoluteDir - The absolute path to the directory where the Map is saved.


Copyright © 2004-2006 Hugues Johnson