|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.huguesjohnson.tiamat.graphics.Map
com.huguesjohnson.tiamat.graphics.TileMap
public class TileMap
TileMap - a map composed of fixed-size tiles
Field Summary |
---|
Fields inherited from class com.huguesjohnson.tiamat.graphics.Map |
---|
absoluteDir, height, name, width |
Constructor Summary | |
---|---|
TileMap()
Default constructor, creates an empty map. |
|
TileMap(int width,
int height,
java.awt.Component canvas)
Create a map with the specified width, height, and canvas. |
Method Summary | |
---|---|
void |
draw()
Draws the entire map. |
void |
draw(int x,
int y)
Draw the tile at (x,y). |
void |
draw(int x1,
int y1,
int x2,
int y2)
Draw the tiles specified by rectangle (x1,y1)-(x2,y2). |
TileMapData |
getMapData(int x,
int y)
Returns the map data at the specified (x,y) co-ordinate. |
java.lang.Object |
getObjectAt(int x,
int y)
Returns the object at (x,y). |
java.awt.image.BufferedImage |
getTile(int index)
Returns the tile at the specified index. |
java.awt.image.BufferedImage[] |
getTileSet()
Returns the tile set for this map. |
boolean |
importObjectData(java.lang.Object[][] objectData)
Imports object data. |
boolean |
importTileData(int[][] tileData)
Imports tile data. |
boolean |
importTileSet(java.lang.String absoluteDir,
java.lang.String[] tilePaths)
Imports tileset data. |
boolean |
importTypeData(int[][] typeData)
Imports type data. |
void |
onDeserialize(Formatter formatter,
java.lang.String absoluteDir)
The onDeserialize event should be fired after an object is de-serialized. |
void |
setCanvas(java.awt.Component canvas)
Override of setCanvas to reload images when canvas changes. |
void |
setMapData(int x,
int y,
TileMapData mapData)
Sets the map data at the specified (x,y) co-ordinate. |
void |
setObjectAt(int x,
int y,
java.lang.Object object)
Sets the object at (x,y). |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class com.huguesjohnson.tiamat.graphics.Map |
---|
getCanvas, getHeight, getName, getWidth, setAbsoluteDir, setHeight, setName, setWidth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TileMap()
public TileMap(int width, int height, java.awt.Component canvas)
width
- The width for this map.height
- The height for this map.canvas
- The canvas for this map.Method Detail |
---|
public java.awt.image.BufferedImage[] getTileSet()
public java.awt.image.BufferedImage getTile(int index)
index
- The index of the time to return.
public TileMapData getMapData(int x, int y)
x
- The x co-ordinate.y
- The y co-ordinate.
public void setMapData(int x, int y, TileMapData mapData)
x
- The x co-ordinate.y
- The y co-ordinate.mapData
- The data to set at (x,y).public void setCanvas(java.awt.Component canvas)
setCanvas
in class Map
canvas
- The new canvas for this map.public boolean importTileSet(java.lang.String absoluteDir, java.lang.String[] tilePaths)
absoluteDir
- The absolute path to where images are stored.tilePaths
- An array of relative paths to images.
public boolean importTileData(int[][] tileData)
tileData
- An array of tile data.
public boolean importTypeData(int[][] typeData)
typeData
- An array of type data.
public boolean importObjectData(java.lang.Object[][] objectData)
objectData
- An array of object data.
public void draw()
draw
in interface Drawable
draw
in class Map
public void draw(int x, int y)
draw
in interface Drawable
draw
in class Map
x
- The x co-ordinate.y
- The y co-ordinate.public void draw(int x1, int y1, int x2, int y2)
draw
in interface Drawable
draw
in class Map
x1
- The starting x co-ordinate.y1
- The starting y co-ordinate.x2
- The ending x co-ordinate.y2
- The ending y co-ordinate.public void setObjectAt(int x, int y, java.lang.Object object)
x
- The x co-ordinate.y
- The y co-ordinate.object
- The object to set at (x,y).public java.lang.Object getObjectAt(int x, int y)
x
- The x co-ordinate.y
- The y co-ordinate.
public java.lang.String toString()
toString
in class Map
public void onDeserialize(Formatter formatter, java.lang.String absoluteDir)
onDeserialize
in interface Storable
onDeserialize
in class Map
formatter
- the formatter to use to load any storable membersabsoluteDir
- the working directory since all paths stored in the object should be relative
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |