📄 tiledlayer.html
字号:
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#createAnimatedTile(int)">createAnimatedTile</A></B>(int staticTileIndex)</CODE>
<BR>
Creates a new animated tile and returns the index that refers to the new animated tile.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#fillCells(int, int, int, int, int)">fillCells</A></B>(int col, int row, int numCols, int numRows, int tileIndex)</CODE>
<BR>
Fills a region cells with the specific tile.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#getAnimatedTile(int)">getAnimatedTile</A></B>(int animatedTileIndex)</CODE>
<BR>
Gets the tile referenced by an animated tile.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#getCell(int, int)">getCell</A></B>(int col, int row)</CODE>
<BR>
Gets the contents of a cell.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#getCellHeight()">getCellHeight</A></B>()</CODE>
<BR>
Gets the height of a single cell, in pixels.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#getCellWidth()">getCellWidth</A></B>()</CODE>
<BR>
Gets the width of a single cell, in pixels.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#getColumns()">getColumns</A></B>()</CODE>
<BR>
Gets the number of columns in the TiledLayer grid.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#getRows()">getRows</A></B>()</CODE>
<BR>
Gets the number of rows in the TiledLayer grid.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#paint(javax.microedition.lcdui.Graphics)">paint</A></B>(<A HREF="../../../../javax/microedition/lcdui/Graphics.html">Graphics</A> g)</CODE>
<BR>
Draws the TiledLayer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#setAnimatedTile(int, int)">setAnimatedTile</A></B>(int animatedTileIndex, int staticTileIndex)</CODE>
<BR>
Associates an animated tile with the specified static tile.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#setCell(int, int, int)">setCell</A></B>(int col, int row, int tileIndex)</CODE>
<BR>
Sets the contents of a cell.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#setStaticTileSet(javax.microedition.lcdui.Image, int, int)">setStaticTileSet</A></B>(<A HREF="../../../../javax/microedition/lcdui/Image.html">Image</A> image, int tileWidth, int tileHeight)</CODE>
<BR>
Change the static tile set.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.lcdui.game.Layer"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class javax.microedition.lcdui.game.<A HREF="../../../../javax/microedition/lcdui/game/Layer.html">Layer</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../javax/microedition/lcdui/game/Layer.html#getHeight()">getHeight</A>, <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#getWidth()">getWidth</A>, <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#getX()">getX</A>, <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#getY()">getY</A>, <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#isVisible()">isVisible</A>, <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#move(int, int)">move</A>, <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#setPosition(int, int)">setPosition</A>, <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#setVisible(boolean)">setVisible</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="../../../../java/lang/Object.html">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="TiledLayer(int, int, javax.microedition.lcdui.Image, int, int)"><!-- --></A><H3>
TiledLayer</H3>
<PRE>
public <B>TiledLayer</B>(int columns, int rows, <A HREF="../../../../javax/microedition/lcdui/Image.html">Image</A> image, int tileWidth, int tileHeight)</PRE>
<DL>
<DD>Creates a new TiledLayer. <p> The TiledLayer's grid will be <code>rows</code> cells high and <code>columns</code> cells wide. All cells in the grid are initially empty (i.e. they contain tile index 0). The contents of the grid may be modified through the use of <A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#setCell(int, int, int)"><CODE>setCell(int, int, int)</CODE></A> and <A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#fillCells(int, int, int, int, int)"><CODE>fillCells(int, int, int, int, int)</CODE></A>. <P> The static tile set for the TiledLayer is created from the specified Image with each tile having the dimensions of tileWidth x tileHeight. The width of the source image must be an integer multiple of the tile width, and the height of the source image must be an integer multiple of the tile height; otherwise, an IllegalArgumentException is thrown;<p> The entire static tile set can be changed using <A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#setStaticTileSet(javax.microedition.lcdui.Image, int, int)"><CODE>setStaticTileSet(Image, int, int)</CODE></A>. These methods should be used sparingly since they are both memory and time consuming. Where possible, animated tiles should be used instead to animate tile appearance.<p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>columns</CODE> - the width of the <code>TiledLayer</code>, expressed as a number of cells<DD><CODE>rows</CODE> - the height of the <code>TiledLayer</code>, expressed as a number of cells<DD><CODE>image</CODE> - the <code>Image</code> to use for creating the static tile set<DD><CODE>tileWidth</CODE> - the width in pixels of a single tile<DD><CODE>tileHeight</CODE> - the height in pixels of a single tile<DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>image</code> is <code>null</code><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the number of <code>rows</code> or <code>columns</code> is less than <code>1</code><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>tileHeight</code> or <code>tileWidth</code> is less than <code>1</code><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the <code>image</code> width is not an integer multiple of the <code>tileWidth</code><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the <code>image</code> height is not an integer multiple of the <code>tileHeight</code></DL>
</DD>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="createAnimatedTile(int)"><!-- --></A><H3>
createAnimatedTile</H3>
<PRE>
public int <B>createAnimatedTile</B>(int staticTileIndex)</PRE>
<DL>
<DD>Creates a new animated tile and returns the index that refers to the new animated tile. It is initially associated with the specified tile index (either a static tile or 0). <P> The indices for animated tiles are always negative. The first animated tile shall have the index -1, the second, -2, etc.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>staticTileIndex</CODE> - the index of the associated tile (must be <code>0</code> or a valid static tile index)<DT><B>Returns:</B><DD>the index of newly created animated tile<DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the <code>staticTileIndex</code> is invalid</DL>
</DD>
</DL>
<HR>
<A NAME="setAnimatedTile(int, int)"><!-- --></A><H3>
setAnimatedTile</H3>
<PRE>
public void <B>setAnimatedTile</B>(int animatedTileIndex, int staticTileIndex)</PRE>
<DL>
<DD>Associates an animated tile with the specified static tile. <p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>animatedTileIndex</CODE> - the index of the animated tile<DD><CODE>staticTileIndex</CODE> - the index of the associated tile (must be <code>0</code> or a valid static tile index)<DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the <code>staticTileIndex</code> is invalid<DD><CODE><A HREF="../../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the animated tile index is invalid<DT><B>See Also: </B><DD><A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html#getAnimatedTile(int)"><CODE>getAnimatedTile(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getAnimatedTile(int)"><!-- --></A><H3>
getAnimatedTile</H3>
<PRE>
public int <B>getAnimatedTile</B>(int animatedTileIndex)</PRE>
<DL>
<DD>Gets the tile referenced by an animated tile. <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -