|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.b3dgs.lionengine.game.map.AbstractTileMap<TTile>
com.b3dgs.lionengine.game.map.AbstractPathMap<TTile>
TTile
- tile type used.public abstract class AbstractPathMap<TTile extends AbstractPathTile>
Abstract representation of a path based map, used for pathfinding.
Field Summary |
---|
Fields inherited from class com.b3dgs.lionengine.game.map.AbstractTileMap |
---|
heightInTile, screenHeight, theme, tileHeight, tilesDir, tileWidth, widthInTile |
Constructor Summary | |
---|---|
AbstractPathMap(java.lang.String tilesDir,
int tileWidth,
int tileHeight,
int screenHeight)
Create a new path map. |
Method Summary | |
---|---|
boolean |
blocked(Pathfindable mover,
int v,
int h,
boolean ignoreRef)
Check if current location is blocking or not. |
boolean |
checkFreePlace(int tx,
int ty,
int w,
int h,
int id)
Check if area if unused. |
void |
create(int widthInTile,
int heightInTile)
Create and prepare map memory area. |
void |
createMiniMap()
Generate the minimap from the current map. |
java.awt.Graphics2D |
createMiniMapGraphics()
Get minimap graphics reference. |
java.util.List<Point2D> |
getAllFreePlaceArround(int tx,
int ty,
int w,
int h,
int id,
int radius)
Search list of free area from this area. |
float |
getCost(Pathfindable mover,
int sx,
int sy,
int tx,
int ty)
Get the cost of the complete path, from start till end. |
Point2D |
getFreePlaceArround(int tx,
int ty,
int w,
int h,
int id,
int radius)
Search a free area from this area. |
int |
getRef(int v,
int h)
Get ref id. |
TTile |
getTileArround(Pathfindable mover,
int v,
int h,
int width,
int height)
Search the first unblocking tile arround location (clock way). |
void |
load(XMLNode root)
Load a map from a specified file as xml. |
void |
pathFinderVisited(int v,
int h)
Mark the tile as visited. |
void |
render(java.awt.Graphics2D g,
Camera camera,
int inTileWidth,
int inTileHeight)
Deprecated. use render(Graphics2D g, StrategyCamera camera, int inTileWidth, int inTileHeight) instead. |
void |
render(java.awt.Graphics2D g,
StrategyCamera camera,
int inTileWidth,
int inTileHeight)
Render map from camera viewpoint, showing a specified area. |
void |
renderMiniMap(java.awt.Graphics2D g,
int x,
int y)
Render minimap on graphic output at specified location. |
protected void |
renderTile(java.awt.Graphics2D g,
TTile tile,
int x,
int y,
int tx,
int ty)
Render a specific tile from specified location. |
void |
setRef(int v,
int h,
int id)
Set ref id. |
Methods inherited from class com.b3dgs.lionengine.game.map.AbstractTileMap |
---|
checkDefaultCollision, clear, createTile, createTile, getCollision, getHeightInTiles, getMiniMap, getPattern, getPatterns, getPatternsNumber, getTheme, getTile, getTileHeight, getTilePixelColor, getTilesNumber, getTileWidth, getWidthInTiles, load, loadPatterns, readCollisions, render, render, render, renderTile, save, save, setTile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.b3dgs.lionengine.game.map.TileBasedMap |
---|
getHeightInTiles, getPatternsNumber, getTile, getTileHeight, getTileWidth, getWidthInTiles, renderTile |
Constructor Detail |
---|
public AbstractPathMap(java.lang.String tilesDir, int tileWidth, int tileHeight, int screenHeight)
tilesDir
- tiles directory.tileWidth
- tile width.tileHeight
- tile height.screenHeight
- screen height.Method Detail |
---|
public void create(int widthInTile, int heightInTile)
AbstractTileMap
create
in class AbstractTileMap<TTile extends AbstractPathTile>
widthInTile
- map width in tile.heightInTile
- map height in tile.@Deprecated public void render(java.awt.Graphics2D g, Camera camera, int inTileWidth, int inTileHeight)
AbstractTileMap
render
in class AbstractTileMap<TTile extends AbstractPathTile>
g
- graphic output.camera
- camera viewpoint.inTileWidth
- number of rendered tiles in width.inTileHeight
- number of rendered tiles in height.public void render(java.awt.Graphics2D g, StrategyCamera camera, int inTileWidth, int inTileHeight)
g
- graphic output.camera
- camera viewpoint.inTileWidth
- number of rendered tiles in width.inTileHeight
- number of rendered tiles in height.protected void renderTile(java.awt.Graphics2D g, TTile tile, int x, int y, int tx, int ty)
AbstractTileMap
renderTile
in class AbstractTileMap<TTile extends AbstractPathTile>
g
- graphic output.tile
- tile to render.x
- location x.y
- location y.tx
- current h tile.ty
- current v tile.public void pathFinderVisited(int v, int h)
PathBasedMap
pathFinderVisited
in interface PathBasedMap<TTile extends AbstractPathTile>
v
- vertical location.h
- horizontal location.public TTile getTileArround(Pathfindable mover, int v, int h, int width, int height)
PathBasedMap
getTileArround
in interface PathBasedMap<TTile extends AbstractPathTile>
mover
- object searching path.v
- vertical location.h
- horizontal location.width
- number of horizontal tiles to search.height
- number of vertical tiles to search.
public boolean blocked(Pathfindable mover, int v, int h, boolean ignoreRef)
PathBasedMap
blocked
in interface PathBasedMap<TTile extends AbstractPathTile>
mover
- object moving on map.v
- vertical location.h
- horizontal location.ignoreRef
- ignore map ref array checking.
public float getCost(Pathfindable mover, int sx, int sy, int tx, int ty)
PathBasedMap
getCost
in interface PathBasedMap<TTile extends AbstractPathTile>
mover
- object moving on map.sx
- starting location x.sy
- starting location y.tx
- ending location x.ty
- ending location y.
public void setRef(int v, int h, int id)
PathBasedMap
setRef
in interface PathBasedMap<TTile extends AbstractPathTile>
v
- vertical index.h
- horizontal index.id
- id to store.public int getRef(int v, int h)
PathBasedMap
getRef
in interface PathBasedMap<TTile extends AbstractPathTile>
v
- vertical index.h
- horizontal index.
public Point2D getFreePlaceArround(int tx, int ty, int w, int h, int id, int radius)
PathBasedMap
getFreePlaceArround
in interface PathBasedMap<TTile extends AbstractPathTile>
tx
- horizontal location.ty
- vertical location.w
- width in tile.h
- height in tile.id
- id to ignore.radius
- search size.
public java.util.List<Point2D> getAllFreePlaceArround(int tx, int ty, int w, int h, int id, int radius)
PathBasedMap
getAllFreePlaceArround
in interface PathBasedMap<TTile extends AbstractPathTile>
tx
- horizontal location.ty
- vertical location.w
- width in tile.h
- height in tile.id
- id to ignore.radius
- search size.
public boolean checkFreePlace(int tx, int ty, int w, int h, int id)
PathBasedMap
checkFreePlace
in interface PathBasedMap<TTile extends AbstractPathTile>
tx
- horizontal location.ty
- vertical location.w
- width in tile.h
- height in tile.id
- id to ignore.
public void load(XMLNode root)
AbstractTileMap
(String) theme (short) width in tiles (short) height in tiles (byte) tile width (byte) tile height (short) tiles number for n = 0 to tileNumber create blank tile call tile.load(file) call this.setTile(...) to update map with this new tile
load
in class AbstractTileMap<TTile extends AbstractPathTile>
root
- input node.public void createMiniMap()
AbstractTileMap
createMiniMap
in class AbstractTileMap<TTile extends AbstractPathTile>
public void renderMiniMap(java.awt.Graphics2D g, int x, int y)
AbstractTileMap
renderMiniMap
in class AbstractTileMap<TTile extends AbstractPathTile>
g
- graphic output.x
- location x.y
- location y.public java.awt.Graphics2D createMiniMapGraphics()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |