|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.piratis.j2me.core.game.Layer org.piratis.j2me.core.game.TiledLayer
A type of Layer composed of a grid of cells which can contain a reduced set of predefined images. This class allows large virtual layers to be created without the need for an extremely large Image. It is commonly used to creat very large scrolling backgrounds.
Field Summary |
Fields inherited from class org.piratis.j2me.core.game.Layer |
bbox, TOP_LEFT, visible |
Constructor Summary | |
TiledLayer(int columns,
int rows,
Image image,
int tileWidth,
int tileHeight)
Creates a new TiledLayer. |
Method Summary | |
boolean |
cellCollides(Layer l)
Check colliding but checking cells. |
int |
createCommonTile(int tileIndex)
Cretates a new common tile returning the index referring to this new common tile. |
void |
fillCells(int col,
int row,
int colNumber,
int rowNumber,
int tileIndex)
Sets the given tileIndex in a given region. |
int |
getCell(int col,
int row)
Gets cell's contents |
int |
getCommonTile(int commonTileIndex)
Gets the tile referenced by the given common tile. |
void |
paint(Graphics g)
Paints this layer if it is visible. |
void |
setCell(int col,
int row,
int tileIndex)
Sets the contents of a cell. |
void |
setCommonTile(int commonTileIndex,
int tileIndex)
Changes the tile associated to this common tile. |
Methods inherited from class org.piratis.j2me.core.game.Layer |
getBbox, isVisible, moveBy, moveTo, setVisible |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TiledLayer(int columns, int rows, Image image, int tileWidth, int tileHeight)
columns
- rows
- image
- tileWidth
- tileHeight
- Method Detail |
public void fillCells(int col, int row, int colNumber, int rowNumber, int tileIndex)
col
- top-left region columnrow
- top-left region rowcolNumber
- region col numberrowNumber
- region row numbertileIndex
- tile index to setpublic void setCell(int col, int row, int tileIndex)
col
- column from the gridrow
- row from the gridtileIndex
- the index of the tilepublic int getCell(int col, int row)
col
- column from the gridrow
- row from the grid
public int createCommonTile(int tileIndex)
tileIndex
-
public int getCommonTile(int commonTileIndex)
commonTileIndex
- the index of the common tile.
public void setCommonTile(int commonTileIndex, int tileIndex)
commonTileIndex
- tileIndex
- public void paint(Graphics g)
Layer
paint
in class Layer
g
- the graphics object for rendering this layerorg.piratis.j2me.core.game.Layer#paint(javax.microedition.lcdui.Graphics)
public boolean cellCollides(Layer l)
l
- Layer to check
|
Copyright(c) 2003-2004 Jordi Martin | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |