|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrlgamekit.map.generators.MapUtils
public class MapUtils
Utility methods for map handling.
| Nested Class Summary | |
|---|---|
static interface |
MapUtils.OpenSquare
Must be subclassed in a game specific manner to tell which sqaures are considered open. |
| Constructor Summary | |
|---|---|
MapUtils()
|
|
| Method Summary | |
|---|---|
void |
fillArea(LayeredMap map,
int layer,
int x,
int y,
int w,
int h,
int[] values)
Fill an area of a map with values. |
void |
fillScriptArea(LayeredMap map,
int x,
int y,
int w,
int h,
java.lang.String value)
Sets the script code for a rectangular area of the map. |
void |
filterOverlapping(java.util.ArrayList<java.awt.Rectangle> list,
int border)
Filter a list of rectangles and so that only non-overlapping recangles remain in the list. |
java.awt.Point |
findNearOpenSquare(LayeredMap map,
int x,
int y,
int range,
MapUtils.OpenSquare predicate)
Find closest open square around x,y in range "range". |
java.util.ArrayList<java.awt.Rectangle> |
findPatternMatches(LayeredMap map,
int layer,
java.lang.String[] pattern,
int areaWidth,
int areaHeight)
Find locations that match an array of patterns. |
java.util.ArrayList<java.awt.Point> |
findRooms(LayeredMap map,
int width,
int height,
MapUtils.OpenSquare predicate)
Find all open areas of the given size. |
boolean |
isInside(int posX,
int posY,
int x,
int y,
int w,
int h)
Checks weather a position is inside a rectangle. |
void |
placeDecoCluster(LayeredMap map,
int[] tiles,
int x,
int y,
int layer,
java.util.Random rand)
Place a cluster of tiles elements at location x,y. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MapUtils()
| Method Detail |
|---|
public java.util.ArrayList<java.awt.Point> findRooms(LayeredMap map,
int width,
int height,
MapUtils.OpenSquare predicate)
map - The map to scan.width - Min. width to findheight - Min. height to findpredicate - Object to check which map cells count as open.
public java.awt.Point findNearOpenSquare(LayeredMap map,
int x,
int y,
int range,
MapUtils.OpenSquare predicate)
x - map X coordinatey - map Y coordinaterange - max radius of searchpredicate - To check squares if they count as open
public java.util.ArrayList<java.awt.Rectangle> findPatternMatches(LayeredMap map,
int layer,
java.lang.String[] pattern,
int areaWidth,
int areaHeight)
map - The map to scan.layer - The layer within the map to scan.pattern - The array of regexps, one for each line of the pattern.areaWidth - Area widthareaHeight - Area height
public boolean isInside(int posX,
int posY,
int x,
int y,
int w,
int h)
posX - position x coordinate.posY - position y coordinate.x - rectangle topy - rectangle leftw - rectangle widthh - rectangle height
public void placeDecoCluster(LayeredMap map,
int[] tiles,
int x,
int y,
int layer,
java.util.Random rand)
tiles - Deco tile array, must have at least 2 elements, better 3layer - The map layer to affect.
public void fillArea(LayeredMap map,
int layer,
int x,
int y,
int w,
int h,
int[] values)
map - The map to work on.layer - The map layer to work on.x - Left of the area.y - Top of the area.w - Width of the area.h - Height of the area.values - Array of tile numbers. Actual values will be chosen
randomly from this.
public void fillScriptArea(LayeredMap map,
int x,
int y,
int w,
int h,
java.lang.String value)
map - The map to work on.x - Left of the area.y - Top of the area.w - Width of the area.h - Height of the area.value - The script code to set.
public void filterOverlapping(java.util.ArrayList<java.awt.Rectangle> list,
int border)
list - The list of rectanglesborder - The amount of overlap that is tolerated
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||