be.saltwater.jaqel.maze
Class TileSet

java.lang.Object
  extended bybe.saltwater.jaqel.maze.TileSet

public class TileSet
extends java.lang.Object

A collection of tiles types, each with it own unique name. A maze has a reference to a tileset and each tile in the maze refers to tile type with its name. A TileSet can be loaded from a file with classes that implement TileSetLoader. At the moment, only XMLTileSetLoader is available.

Author:
Bruno Windels
See Also:
Tile, Maze

Constructor Summary
TileSet()
          Constructs a new TileSet.
TileSet(java.lang.String name)
          Constructs a new TileSet.
 
Method Summary
 void addTile(java.lang.String name, Tile tile)
          Add a tile to this tileset, this method has no effect if there is already a tile with the given name.
 java.lang.String getName()
          Returns the name of this tileset.
 Tile getTile(java.lang.String name)
          Returns the tile identified by the given name.
static float getTileSize()
          Returns the size of the visual representation (Shape3D) tile in this tileset.
 void setName(java.lang.String name)
          Sets the name of this tileset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TileSet

public TileSet()
Constructs a new TileSet.


TileSet

public TileSet(java.lang.String name)
Constructs a new TileSet.

Parameters:
name - The name for this tileset, it is passed to setName.
See Also:
setName
Method Detail

setName

public void setName(java.lang.String name)
Sets the name of this tileset.

See Also:
getName

getName

public java.lang.String getName()
Returns the name of this tileset. This feature is not frequently used. The name doesn't have to be unique.

See Also:
setName

addTile

public void addTile(java.lang.String name,
                    Tile tile)
Add a tile to this tileset, this method has no effect if there is already a tile with the given name. This function should probably only be called by a TileSetLoader. A Tile should not be part of more than one TileSet because TileSet sets the bounds for its tile objects.

Parameters:
name - The unique name for the tile.
tile - The tile that must be added.
See Also:
TileSetLoader, Tile

getTile

public Tile getTile(java.lang.String name)
Returns the tile identified by the given name.

Parameters:
name - The unique name for the tile.

getTileSize

public static float getTileSize()
Returns the size of the visual representation (Shape3D) tile in this tileset. This is used by Maze to calculate the transformations to place the tiles next to each other.