public class Map extends AbstractRasteredTileMap<Tile>
Modifier and Type | Field and Description |
---|---|
static int |
H_MARGIN |
static int |
V_MARGIN |
rasterFile
collisions, fact, heightInTile, screenHeight, theme, tileHeight, tileWidth, widthInTile
DIR
Constructor and Description |
---|
Map() |
Map(AbstractWorld world) |
Modifier and Type | Method and Description |
---|---|
Tile |
createTile(int pattern,
int number,
int x,
int y,
java.lang.String collision) |
void |
load(FileReader file)
Load a map from a specified file as binary data.
|
void |
loadXML(XMLNode root)
Load a map from a specified file as xml.
|
void |
render(java.awt.Graphics2D g,
int sx,
int sy,
int inTileWidth,
int inTileHeight)
Render map from starting position, in defined area.
|
protected void |
renderTile(java.awt.Graphics2D g,
Tile tile,
int tx,
int ty)
Render a specific tile from specified location (different to the other renderTile, as it is called in render function).
|
void |
save(FileWriter file)
Save map to specified file as binary data.
|
void |
saveXML(XMLNode root)
Save map to specified file as xml.
|
getRasterIndex, getRasterPattern, loadPatterns, setRaster
create, getCollision, getHeightInTiles, getPattern, getPatterns, getPatternsNumber, getTheme, getTile, getTileHeight, getTilesNumber, getTileWidth, getWidthInTiles, readCollisions, render, render, renderTile, setTile
public static final int H_MARGIN
public static final int V_MARGIN
public Map()
public Map(AbstractWorld world)
public Tile createTile(int pattern, int number, int x, int y, java.lang.String collision)
createTile
in class AbstractTileMap<Tile>
public void render(java.awt.Graphics2D g, int sx, int sy, int inTileWidth, int inTileHeight)
AbstractTileMap
render
in class AbstractTileMap<Tile>
g
- graphic output.sx
- starting x (player real location x).sy
- starting y (player real location y).inTileWidth
- number of rendered tile in width.inTileHeight
- number of rendered tile in height.protected void renderTile(java.awt.Graphics2D g, Tile tile, int tx, int ty)
AbstractTileMap
renderTile
in class AbstractRasteredTileMap<Tile>
g
- graphic output.tile
- tile to render.tx
- location x.ty
- location y.public void save(FileWriter file) throws java.io.IOException
AbstractTileMap
save
in class AbstractTileMap<Tile>
file
- output file.java.io.IOException
- thrown in case of output error.public void load(FileReader file) throws java.io.IOException
AbstractTileMap
load
in class AbstractTileMap<Tile>
file
- input file.java.io.IOException
- thrown in case of output error.public void saveXML(XMLNode root)
AbstractTileMap
saveXML
in class AbstractTileMap<Tile>
root
- output node.public void loadXML(XMLNode root)
AbstractTileMap
loadXML
in class AbstractTileMap<Tile>
root
- input node.