public class DungeonBoneGen
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
GreasedRegion |
region
A GreasedRegion that, after
generate(TilesetType, int, int) has been called, will hold the floor cells
in its data as "on" cells and walls as "off" cells. |
IRNG |
rng
|
GreasedRegion |
workingRegion
Not recommended for general usage; a GreasedRegion that is frequently modified by this generator and is kept
in a field so this and potentially other classes can avoid allocating new GreasedRegions with
GreasedRegion.remake(GreasedRegion) or the various refill methods in GreasedRegion. |
Constructor and Description |
---|
DungeonBoneGen()
Constructs a DungeonBoneGen that uses a default RNG, randomly seeded.
|
DungeonBoneGen(IRNG random)
Constructs a DungeonBoneGen that uses the given IRNG.
|
DungeonBoneGen(java.util.Random random)
Constructs a DungeonBoneGen that uses the given java.util.Random .
|
Modifier and Type | Method and Description |
---|---|
char[][] |
generate(Tileset ts,
int w,
int h)
Generate a dungeon given a Tileset.
|
char[][] |
generate(TilesetType tt,
int w,
int h)
Generate a dungeon given a TilesetType enum.
|
char |
get(int x,
int y)
Gets the char at a given x,y position.
|
char[][] |
getDungeon()
Get the char[][] dungeon that was last returned by generate(), or null if generate() or setDungeon have not been
called.
|
int |
getHeight()
Returns the height, used as the second coordinate in any char[][] in this class.
|
IRNG |
getRng()
Gets the current RNG.
|
int |
getWidth()
Returns the width, used as the first coordinate in any char[][] in this class.
|
void |
put(char elem,
int x,
int y)
Sets the char at the given x,y position, storing it in this object.
|
void |
setDungeon(char[][] dungeon)
Change the stored char[][] dungeon, using x,y indexing.
|
void |
setRng(IRNG rng)
Sets the current RNG.
|
java.lang.String |
toString()
Provides a string representation of the latest generated dungeon.
|
char[][] |
wallWrap()
Changes the outer edge of this dungeon to the wall char, '#'.
|
static char[][] |
wallWrap(char[][] map)
Changes the outer edge of a char[][] to the wall char, '#'.
|
public IRNG rng
public GreasedRegion region
generate(TilesetType, int, int)
has been called, will hold the floor cells
in its data as "on" cells and walls as "off" cells. This can be useful for inter-operating with code that expects
a GreasedRegion, which can be for various reasons.public transient GreasedRegion workingRegion
GreasedRegion.remake(GreasedRegion)
or the various refill methods in GreasedRegion.public DungeonBoneGen(java.util.Random random)
random
- A Random number generator to be used during the dungeon generation; it will
be used to generate a seed for the internal RNG this class uses.public DungeonBoneGen(IRNG random)
public DungeonBoneGen()
public IRNG getRng()
public void setRng(IRNG rng)
rng
- public int getWidth()
public int getHeight()
public char[][] getDungeon()
public void setDungeon(char[][] dungeon)
dungeon
- public char get(int x, int y)
x
- y
- public void put(char elem, int x, int y)
elem
- x
- y
- public char[][] generate(TilesetType tt, int w, int h)
tt
- A TilesetType enum; try lots of these out to see how they look.w
- Width of the dungeon to generate in chars.h
- Height of the dungeon to generate in chars.public static char[][] wallWrap(char[][] map)
map
- A char[][] that stores map data.public char[][] wallWrap()
public char[][] generate(Tileset ts, int w, int h)
ts
- A Tileset; if you don't have one of these available, use a TilesetType enum instead to select a predefined one.h
- Height of the dungeon to generate in chars.w
- Width of the dungeon to generate in chars.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © Eben Howard 2012–2022. All rights reserved.