|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jtgl.gaming.Surface
org.jtgl.gaming.TiledSurface
public class TiledSurface
Represents a surface compound of image tiles (each tile could be empty of filled with a static or animated image)
Field Summary | |
---|---|
boolean |
showGrid
|
Constructor Summary | |
---|---|
TiledSurface(int cellRows,
int cellColumns,
ImageMatrix imageMatrix)
Creates a new instance of TiledSurface |
|
TiledSurface(int cellRows,
int cellColumns,
JTGLImage image,
int frameWidth,
int frameHeight)
|
Method Summary | |
---|---|
int |
createAnimatedTile(int staticIndex)
|
void |
draw(JTGLGraphics g)
|
void |
fillCells(int col,
int row,
int numCols,
int numRows,
int cellValue)
|
int |
getAnimatedCells()
|
short |
getAnimatedTile(int animatedIndex)
Gets the tile referenced by an animated tile. |
short |
getCell(int col,
int row)
|
short |
getCellAt(int x,
int y)
|
int |
getCellHeight()
|
short |
getCellValue(int index)
|
int |
getCellWidth()
|
int |
getCellX(int col)
|
int |
getCellY(int row)
|
int |
getCol(int x)
|
int |
getColumns()
|
short[] |
getMap()
|
int |
getNumCells()
|
int |
getNumTiles()
|
int |
getRow(int y)
|
int |
getRows()
|
int |
getViewHeight()
|
int |
getViewWidth()
|
int |
getViewX()
|
int |
getViewY()
|
void |
modCell(int oldIndex,
int newIndex)
Modify all cells with values oldIndex to value newIndex |
void |
modCells(int savedIndex,
int newValue)
Modify all cells with values oldIndex to value newIndex . |
int |
modSaveCells(int value)
Faster method than modCell(int oldIndex,int newIndex) that scans whole map and save cell locations containing the passed value |
int |
modSaveCells(int value,
int reserveSlots)
Faster method than modCell(int oldIndex,int newIndex) that scans whole map and save all cell locations (indexes within cell-map) containing the passed value |
void |
moveView(int dx,
int dy)
|
void |
resetMap(int cellRows,
int cellColumns)
|
void |
setAnimatedTile(int animatedIndex,
int staticIndex)
Associates an animated tile with the specified static tile. |
void |
setCell(int col,
int row,
int index)
|
void |
setCellValue(int index,
int value)
|
void |
setImageMatrix(ImageMatrix imageMatrix,
boolean clearMap)
|
void |
setMap(short[] map)
|
void |
setStaticTileSet(JTGLImage image,
int cellWidth,
int cellHeight)
|
void |
setViewLocation(int x,
int y)
|
void |
setViewWindow(int x,
int y,
int width,
int height)
|
void |
setViewWindowFromViewPort(int vx,
int vy,
int vWidth,
int vHeight)
|
protected int |
updateViewCols(int viewWidth,
int cellWidth)
|
protected int |
updateViewRows(int viewHeight,
int cellHeight)
|
Methods inherited from class org.jtgl.gaming.Surface |
---|
getAbsRefLocation, getBounds, getCenterLocation, getHeight, getLocation, getRefLocation, getWidth, getX, getY, isVisible, move, setAbsRefLocation, setLocation, setRefLocation, setVisible |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean showGrid
Constructor Detail |
---|
public TiledSurface(int cellRows, int cellColumns, ImageMatrix imageMatrix)
public TiledSurface(int cellRows, int cellColumns, JTGLImage image, int frameWidth, int frameHeight)
Method Detail |
---|
public void resetMap(int cellRows, int cellColumns)
public void setStaticTileSet(JTGLImage image, int cellWidth, int cellHeight)
public void setImageMatrix(ImageMatrix imageMatrix, boolean clearMap)
public final int getNumCells()
public final int getNumTiles()
public final int getAnimatedCells()
public final int getRows()
public final int getColumns()
public final int getCellWidth()
public final int getCellHeight()
public void setMap(short[] map)
public short[] getMap()
public void setCell(int col, int row, int index)
public void setCellValue(int index, int value)
public short getCell(int col, int row)
public short getCellValue(int index)
public int getCellX(int col)
public int getCellY(int row)
public int getCol(int x)
public int getRow(int y)
public short getCellAt(int x, int y)
public final void modCell(int oldIndex, int newIndex)
oldIndex
to value newIndex
public int modSaveCells(int value, int reserveSlots)
value
public int modSaveCells(int value)
value
public void modCells(int savedIndex, int newValue)
oldIndex
to value newIndex
.
This method is faster than modCell
but requires a previous call to
modSaveCells
to allocate an index to a saved value.
modSaveCells
public int createAnimatedTile(int staticIndex)
public void setAnimatedTile(int animatedIndex, int staticIndex)
animatedIndex
- the index of the animated tilestaticIndex
- the index of the associated tile
(must be 0
or a valid static tile index)
java.lang.IndexOutOfBoundsException
- if the
staticIndex
is invalid
java.lang.IndexOutOfBoundsException
- if the animated tile index
is invalidgetAnimatedTile(int)
public short getAnimatedTile(int animatedIndex)
Returns the tile index currently associated with the animated tile.
animatedIndex
- the index of the animated tile
java.lang.IndexOutOfBoundsException
- if the animated tile index
is invalidsetAnimatedTile(int, int)
public void fillCells(int col, int row, int numCols, int numRows, int cellValue)
public void setViewWindowFromViewPort(int vx, int vy, int vWidth, int vHeight)
public void setViewWindow(int x, int y, int width, int height)
public void setViewLocation(int x, int y)
public int getViewX()
public int getViewY()
public int getViewWidth()
public int getViewHeight()
public void moveView(int dx, int dy)
public void draw(JTGLGraphics g)
draw
in class Surface
protected int updateViewCols(int viewWidth, int cellWidth)
protected int updateViewRows(int viewHeight, int cellHeight)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |