org.newdawn.slick.tiled
Class TileSet

java.lang.Object
  extended by org.newdawn.slick.tiled.TileSet

public class TileSet
extends java.lang.Object

A holder for tileset information

Author:
kevin

Field Summary
 int firstGID
          The first global tile id in the set
 int index
          The index of the tile set
 int lastGID
          The local global tile id in the set
 java.lang.String name
          The name of the tile set
 int tileHeight
          The height of the tiles
protected  int tileMargin
          The margin of the tileset
 SpriteSheet tiles
          The image containing the tiles
 int tilesAcross
          The number of tiles across the sprite sheet
 int tilesDown
          The number of tiles down the sprite sheet
protected  int tileSpacing
          The padding of the tiles
 int tileWidth
          The width of the tiles
 
Constructor Summary
TileSet(TiledMap map, org.w3c.dom.Element element, boolean loadImage)
          Create a tile set based on an XML definition
 
Method Summary
 boolean contains(int gid)
          Check if this tileset contains a particular tile
 java.util.Properties getProperties(int globalID)
          Get the properties for a specific tile in this tileset
 int getTileHeight()
          Get the height of each tile in this set
 int getTileMargin()
          Get the margin around tiles in this set
 int getTileSpacing()
          Get the spacing between tiles in this set
 int getTileWidth()
          Get the width of each tile in this set
 int getTileX(int id)
          Get the x position of a tile on this sheet
 int getTileY(int id)
          Get the y position of a tile on this sheet
 void setLimit(int limit)
          Set the limit of the tiles in this set
 void setTileSetImage(Image image)
          Set the image to use for this sprite sheet image to use for this tileset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

public int index
The index of the tile set


name

public java.lang.String name
The name of the tile set


firstGID

public int firstGID
The first global tile id in the set


lastGID

public int lastGID
The local global tile id in the set


tileWidth

public int tileWidth
The width of the tiles


tileHeight

public int tileHeight
The height of the tiles


tiles

public SpriteSheet tiles
The image containing the tiles


tilesAcross

public int tilesAcross
The number of tiles across the sprite sheet


tilesDown

public int tilesDown
The number of tiles down the sprite sheet


tileSpacing

protected int tileSpacing
The padding of the tiles


tileMargin

protected int tileMargin
The margin of the tileset

Constructor Detail

TileSet

public TileSet(TiledMap map,
               org.w3c.dom.Element element,
               boolean loadImage)
        throws SlickException
Create a tile set based on an XML definition

Parameters:
element - The XML describing the tileset
map - The map this tileset was loaded from (gives context to paths)
loadImage - True if we should load the image (useful in headless mode)
Throws:
SlickException - Indicates a failure to parse the tileset
Method Detail

getTileWidth

public int getTileWidth()
Get the width of each tile in this set

Returns:
The width of each tile in this set

getTileHeight

public int getTileHeight()
Get the height of each tile in this set

Returns:
The height of each tile in this set

getTileSpacing

public int getTileSpacing()
Get the spacing between tiles in this set

Returns:
The spacing between tiles in this set

getTileMargin

public int getTileMargin()
Get the margin around tiles in this set

Returns:
The maring around tiles in this set

setTileSetImage

public void setTileSetImage(Image image)
Set the image to use for this sprite sheet image to use for this tileset

Parameters:
image - The image to use for this tileset

getProperties

public java.util.Properties getProperties(int globalID)
Get the properties for a specific tile in this tileset

Parameters:
globalID - The global ID of the tile whose properties should be retrieved
Returns:
The properties for the specified tile, or null if no properties are defined

getTileX

public int getTileX(int id)
Get the x position of a tile on this sheet

Parameters:
id - The tileset specific ID (i.e. not the global one)
Returns:
The index of the tile on the x-axis

getTileY

public int getTileY(int id)
Get the y position of a tile on this sheet

Parameters:
id - The tileset specific ID (i.e. not the global one)
Returns:
The index of the tile on the y-axis

setLimit

public void setLimit(int limit)
Set the limit of the tiles in this set

Parameters:
limit - The limit of the tiles in this set

contains

public boolean contains(int gid)
Check if this tileset contains a particular tile

Parameters:
gid - The global id to seach for
Returns:
True if the ID is contained in this tileset


Copyright © 2006 New Dawn Software. All Rights Reserved.