Motorola C550 用户手册

下载
页码 86
 
multiple of the tile width. The height of the source image must be an integer multiple 
of the tile height. 
The tiles in the source image will have indices as follows: 
The static tiles are indexed like words are read on a page; left-to-right, then top-to-
bottom. The top-left tile is assigned index 1. If there is a tile to its right, this tile is 
assigned index 2, and so on, across the first row of tiles. If there is a second row of 
tiles, the index of the left-most tile in this row is one greater than the right-most tile in 
the preceding row. The table below is a diagrammatic depiction: 
. . . 
N+1 
N + 2 
. . . 
2N 
2N+1 
2N + 2 
. . . 
 
. . . 
. . . 
. . . 
. . . 
[(M – 1) * 
N]+1 
[(M-1) * N )] + 2 
. . . 
(M * N ) 
 
 
 
So the total number of tiles is M * N, where:  
− 
N = (image width) / (tile width); 
− 
M = (image height) / (tile height). 
The indices for the static tile set will be non-negative (>=0) and the indices for 
animated tiles will be negative (<0). The index sets do not overlap and therefore 
indices for static and animated tiles can be used interchangeably in the methods that 
set or move the contents of the 
PlayField
 cells. The static Tile set shall behave as 
if the image used in creation were cached. If a mutable image is used to create the 
tiles, the tiles' appearances should not reflect changes to the mutable source image. 
The appearance of individual static tiles can be changed with 
setStaticTileImage()
. The entire static tile set can be changed using 
setStaticTileSet()
. These methods should be used sparingly since they 
are both memory and time consuming.  
PlayField (
int columns, int rows, int cellWidth, 
int cellHeight) 
throws IllegalArgumentException
 - 
Creates a new 
PlayField
 without a tile set. The parameter are the following:   
− 
columns
 - width of the PlayField in number of cells; 
− 
rows
 - height of the PlayField in number of cells; 
− 
cellWidth
 - Pixel width of each cell; 
− 
cellHeight
 - Pixel height of each cell. 
It creates a new 
PlayField
rows
 cells high and 
columns
 cells wide. A 
PlayField created with this constructor will not have any tiles (animated or static) 
associated with it. The primary use of a 
PlayField
 without tiles is expected to be 
as a container for managing sprites. The on-screen pixel dimensions of cells is 
defined by the parameters 
cellWidth
 and 
cellHeight
. The cells in the