|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.AbstractMedia
com.threerings.media.sprite.Sprite
com.threerings.puzzle.drop.client.DropSprite
com.threerings.puzzle.drop.client.DropBlockSprite
public class DropBlockSprite
The drop block sprite represents a block of multiple pieces that can be rotated to any of the four cardinal compass directions. As such, it may span multiple columns or rows depending on its orientation. The block has a "central" piece around which it rotates, with the other pieces referred to as "external" pieces.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.puzzle.drop.client.DropSprite |
|---|
DropSprite.PieceMovedOp |
| Nested classes/interfaces inherited from class com.threerings.media.sprite.Sprite |
|---|
com.threerings.media.sprite.Sprite.CancelledOp, com.threerings.media.sprite.Sprite.CompletedOp |
| Field Summary | |
|---|---|
protected int[] |
_cols
The drop block piece columns. |
protected Rectangle |
_dbounds
The drop block bounds in board coordinates. |
protected int |
_ecol
The external piece location in board coordinates. |
protected int |
_erow
The external piece location in board coordinates. |
protected byte |
_popups
How many times this sprite can be popped-up a row in a forgiving rotation. |
protected int[] |
_rows
The drop block piece rows. |
| Fields inherited from class com.threerings.puzzle.drop.client.DropSprite |
|---|
_bouncing, _col, _destPos, _dist, _endstamp, _offx, _offy, _pieces, _renderPos, _row, _rowstamp, _srcPos, _stopstamp, _unit, _vel, _view, DEFAULT_VELOCITY, ORIENT_DX, ORIENT_DY |
| Fields inherited from class com.threerings.media.sprite.Sprite |
|---|
_orient, _ox, _oxoff, _oy, _oyoff, _path, _pathStamp |
| Fields inherited from class com.threerings.media.AbstractMedia |
|---|
_bounds, _firstTick, _mgr, _observers, _renderOrder, HUD_LAYER |
| Fields inherited from interface com.threerings.util.DirectionCodes |
|---|
CARDINAL_DIRECTIONS, CCW, CW, DIRECTION_COUNT, DOWN, EAST, EASTNORTHEAST, EASTSOUTHEAST, FINE_DIRECTION_COUNT, HORIZONTAL, LEFT, NONE, NORTH, NORTHEAST, NORTHNORTHEAST, NORTHNORTHWEST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHSOUTHEAST, SOUTHSOUTHWEST, SOUTHWEST, UP, VERTICAL, WEST, WESTNORTHWEST, WESTSOUTHWEST |
| Constructor Summary | |
|---|---|
DropBlockSprite(DropBoardView view,
int col,
int row,
int orient,
int[] pieces)
Constructs a drop block sprite and starts it dropping. |
|
DropBlockSprite(DropBoardView view,
int col,
int row,
int orient,
int[] pieces,
int renderOrder)
Constructs a drop block sprite and starts it dropping. |
|
| Method Summary | |
|---|---|
protected int |
calculateExternalColumn()
Returns the column the external piece is located in based on the current central piece location and sprite orientation. |
protected int |
calculateExternalRow()
Returns the row the external piece is located in based on the current central piece location and sprite orientation. |
boolean |
canPopup()
Can this sprite pop-up a row on a forgiving rotation? |
void |
didPopup()
Called if we pop up to decrement the remaining popups we have. |
Rectangle |
getBoardBounds()
Returns the bounds of the block in board piece coordinates. |
int[] |
getColumns()
Returns an array of the column numbers containing the block pieces. |
int |
getExternalColumn()
Returns the column the external piece is located in. |
int |
getExternalRow()
Returns the row the external piece is located in. |
int[] |
getRows()
Returns an array of the row numbers containing the block pieces. |
protected void |
init()
|
void |
setBoardLocation(int row,
int col)
Sets the row and column the piece is located in. |
void |
setColumn(int col)
Sets the column the piece is located in. |
void |
setOrientation(int orient)
Updates the sprite image offset to reflect the direction in which the external piece is hanging. |
void |
setRow(int row)
Set the row the piece is located in. |
void |
toString(StringBuilder buf)
|
protected void |
updateDropInfo()
Re-calculates the external piece position and bounds of the drop block. |
| Methods inherited from class com.threerings.puzzle.drop.client.DropSprite |
|---|
advancePosition, drop, fastForward, getColumn, getDistance, getPercentDone, getPieces, getRow, getVelocity, inside, isBouncing, isDropping, paint, paintPieceImage, setBouncing, setColumnOffset, setPieces, setRowOffset, setVelocity, shiftForBounce, stop, tick, updateBounds, updatePosition, updateRenderOffset |
| Methods inherited from class com.threerings.media.sprite.Sprite |
|---|
addSpriteObserver, cancelMove, contains, getHeight, getOrientation, getPath, getWidth, getX, getXOffset, getY, getYOffset, hitTest, intersects, isMoving, move, paintPath, pathBeginning, pathCompleted, removeSpriteObserver, setLocation, shutdown, tickPath, updateRenderOrigin, viewLocationDidChange |
| Methods inherited from class com.threerings.media.AbstractMedia |
|---|
addObserver, contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, getRenderOrder, init, intersects, intersects, invalidate, invalidateAfterChange, naturalCompareTo, queueNotification, removeObserver, renderCompareTo, setRenderOrder, toString, willStart |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.threerings.media.util.Pathable |
|---|
getBounds |
| Field Detail |
|---|
protected byte _popups
protected Rectangle _dbounds
protected int[] _rows
protected int[] _cols
protected int _ecol
protected int _erow
| Constructor Detail |
|---|
public DropBlockSprite(DropBoardView view,
int col,
int row,
int orient,
int[] pieces)
view - the board view upon which this sprite will be displayed.col - the column of the central piece.row - the row of the central piece.orient - the orientation of the sprite.pieces - the pieces displayed by the sprite.
public DropBlockSprite(DropBoardView view,
int col,
int row,
int orient,
int[] pieces,
int renderOrder)
view - the board view upon which this sprite will be displayed.col - the column of the central piece.row - the row of the central piece.orient - the orientation of the sprite.pieces - the pieces displayed by the sprite.renderOrder - the rendering order of the sprite.| Method Detail |
|---|
protected void init()
init in class DropSpritepublic int[] getRows()
public int[] getColumns()
public Rectangle getBoardBounds()
public int getExternalRow()
public int getExternalColumn()
public void setColumn(int col)
DropSprite
setColumn in class DropSpritepublic void setRow(int row)
DropSprite
setRow in class DropSprite
public void setBoardLocation(int row,
int col)
DropSprite
setBoardLocation in class DropSpritepublic void setOrientation(int orient)
setOrientation in interface com.threerings.media.util.PathablesetOrientation in class DropSpritepublic void toString(StringBuilder buf)
toString in class DropSpritepublic boolean canPopup()
public void didPopup()
protected void updateDropInfo()
protected int calculateExternalRow()
protected int calculateExternalColumn()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||