|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.common.util.Borderer
This class handles choosing terrain borders. It determines whether borders are required and caches information about them for later.
The methods of this class are unsynchronized and unprotected against access by multiple threads. The class is shared by the game client and the map editor, although the map editor uses a subclass that doesn't try to fetch images that it can't find.
Constructor Summary | |
Borderer()
Constructs a new Borderer |
Method Summary | |
java.awt.Image[] |
chooseBorders(int x,
int y,
TerrainInfo[][] map)
Chooses a set of borders for a given location in the map. |
java.awt.Image |
getBorder(int tile,
int number)
Gets the numbered border for a tile. |
java.lang.String |
getBorderBase(java.lang.String terrain)
Returns the base for the border bitmap given a terrain type. |
protected java.lang.String |
getImageName(int tile)
Looks up an image from its tile number. |
protected abstract java.awt.Image |
loadImage(java.lang.String name)
Loads the image file given its name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Borderer()
Method Detail |
public java.awt.Image[] chooseBorders(int x, int y, TerrainInfo[][] map)
map
- an array of TerrainInfo objects. It must be at
least large enough to examine the 8 adjacent neighbors of the
passed location in the array; thus the minimum size is 3x3.x
- the array x index to choose borders fory
- the array y index to choose borders for
public java.awt.Image getBorder(int tile, int number)
tile
- the tile number of the image whose borders we wantnumber
- the border number (1-20) to load
public java.lang.String getBorderBase(java.lang.String terrain)
terrain
- the terrain, e.g. "terrain/clover"
protected abstract java.awt.Image loadImage(java.lang.String name)
name
- something like "terrain/borders/forest/forestBorder10"
protected java.lang.String getImageName(int tile)
tile
- the tile number to look up
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |