|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.threerings.media.MediaPanel
com.threerings.media.VirtualMediaPanel
com.threerings.puzzle.client.PuzzleBoardView
com.threerings.puzzle.drop.client.DropBoardView
public abstract class DropBoardView
The drop board view displays a drop puzzle game in progress for a single player.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.media.MediaPanel |
|---|
com.threerings.media.MediaPanel.ActionSpriteHandler, com.threerings.media.MediaPanel.Obscurer |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected int |
_bhei
The board dimensions in pieces. |
protected int |
_bwid
The board dimensions in pieces. |
protected DropBoard |
_dboard
The drop board. |
protected boolean[] |
_moving
Indicates whether a piece is en route to its destination. |
protected int |
_phei
The piece dimensions in pixels. |
protected com.threerings.media.sprite.Sprite[] |
_pieces
A sprite for every piece displayed in the drop board. |
protected int |
_pwid
The piece dimensions in pixels. |
protected int |
_roff
The board rising offset. |
static Color |
CHAIN_COLOR
The color used to render chain reward scoring text. |
static Color |
SCORE_COLOR
The color used to render normal scoring text. |
| Fields inherited from class com.threerings.puzzle.client.PuzzleBoardView |
|---|
_actionAnimObs, _actionAnims, _actionSprites, _avoidArranger, _background, _board, _bounds, _ctx, _pauseLabel, _pctrl, _scoreDist, ACTION_CLEARED, ACTION_GOING, CLEAR_PENDING, DEBUG_ACTION, DEFAULT_SCORE_DISTANCE |
| Fields inherited from class com.threerings.media.VirtualMediaPanel |
|---|
_abounds, _dx, _dy, _fmode, _fpath, _nx, _ny, _trackers, _vbounds, CENTER_ON_PATHABLE, ENCLOSE_PATHABLE, TRACK_PATHABLE |
| Fields inherited from class com.threerings.media.MediaPanel |
|---|
_actionHandler, _actionSpriteCount, _animmgr, _metamgr, _obscurerList, _remgr, _spritemgr, _tickPaintPending |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface com.threerings.puzzle.drop.data.DropPieceCodes |
|---|
DROP_BLOCK_PIECE_COUNT, PIECE_NONE |
| 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 |
| Fields inherited from interface com.threerings.media.MediaConstants |
|---|
ALL, BACK, FRONT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
DropBoardView(PuzzleContext ctx,
int pwid,
int phei)
Constructs a drop board view. |
|
| Method Summary | |
|---|---|
protected void |
centerRectInBoardRect(int bx,
int by,
int bwid,
int bhei,
int rwid,
int rhei,
Point pos)
Populates pos with the most appropriate screen coordinates to center a
rectangle of the given width and height (in pixels) within the specified rectangle (in
board coordinates). |
void |
clearPiece(int xx,
int yy)
Clears out a piece from the board along with its piece sprite. |
void |
clearPieceSprite(int xx,
int yy)
Clears the specified piece from the board. |
void |
createPiece(int piece,
int sx,
int sy)
Creates a new piece sprite and places it directly in its correct position. |
void |
createPiece(int piece,
int sx,
int sy,
int tx,
int ty,
long duration)
Creates a new piece sprite and moves it into position on the board. |
DropSprite |
createPieces(int col,
int row,
int[] pieces,
int dist)
Creates a new drop sprite used to animate the given pieces falling in the specified column. |
protected com.threerings.media.sprite.Sprite |
createPieceSprite(int piece,
int px,
int py)
Creates the sprite that is used to display the specified piece. |
ScoreAnimation |
createScoreAnimation(String score,
Color color,
Font font)
Creates and returns an animation showing the specified score floating up the view, with the label initially centered within the view. |
ScoreAnimation |
createScoreAnimation(String score,
Color color,
Font font,
int x,
int y,
int width,
int height)
Creates and returns an animation showing the specified score floating up the view. |
void |
dirtySegment(int dir,
int col,
int row,
int len)
Dirties the rectangle encompassing the segment with the given direction and length whose bottom-leftmost corner is at (col, row). |
int |
getPieceHeight()
Returns the height in pixels of a single board piece. |
com.threerings.media.image.Mirage |
getPieceImage(int piece)
Returns the image used to display the given piece at coordinates (0, 0) with
an orientation of DirectionCodes.NORTH. |
abstract com.threerings.media.image.Mirage |
getPieceImage(int piece,
int col,
int row,
int orient)
Returns the image used to display the given piece at the specified column and row with the given orientation. |
void |
getPiecePosition(int col,
int row,
Point pos)
Called by the DropSprite to populate pos with the screen coordinates
in pixels at which a piece at (col, row) in the board should be drawn. |
Dimension |
getPieceSegmentSize(int col,
int row,
int orient,
int len)
Called by the DropSprite to get the dimensions of the area that will be occupied by
rendering a piece segment of the given orientation and length whose bottom-leftmost corner
is at (col, row). |
com.threerings.media.sprite.Sprite |
getPieceSprite(int xx,
int yy)
Returns the piece sprite at the specified location. |
int |
getPieceWidth()
Returns the width in pixels of a single board piece. |
Dimension |
getPreferredSize()
|
boolean |
inBounds(int col,
int row)
Returns true if the specified coordinate is within the bounds of the board, false if it is not. |
void |
init(GameConfig config)
Initializes the board with the board dimensions. |
protected boolean |
isMoving(int px,
int py)
Returns true if the piece that is supposed to be at the specified coordinates is not yet there but is actually en route to that location (due to a call to movePiece(Sprite,int,int,int,int,long)). |
com.threerings.media.sprite.Sprite |
movePiece(int sx,
int sy,
int tx,
int ty,
long duration)
Instructs the view to move the piece at the specified starting position to the specified destination position. |
protected void |
movePiece(com.threerings.media.sprite.Sprite piece,
int sx,
int sy,
int tx,
int ty,
long duration)
A helper function for moving pieces into place. |
void |
paintBetween(Graphics2D gfx,
Rectangle dirtyRect)
|
protected void |
pieceArrived(long tickStamp,
com.threerings.media.sprite.Sprite sprite,
int px,
int py)
Called when a piece is finished moving into its requested position. |
protected void |
renderRisingPieces(Graphics2D gfx,
Rectangle dirtyRect)
Renders the row of rising pieces to the given graphics context. |
void |
rotateDropBlock(DropBlockSprite sprite,
int orient)
Rotates the given drop block sprite to the specified orientation, updating the image as necessary. |
void |
setBoard(Board board)
Sets the board to be displayed. |
protected void |
setRiseOffset(int y)
Sets the board rising offset to the given y-position. |
void |
updatePiece(int sx,
int sy)
Refreshes the piece sprite at the specified location, if no sprite exists at the location, one will be created. |
void |
updatePiece(int piece,
int sx,
int sy)
Updates the piece sprite at the specified location, if no sprite exists at the location, one will be created. |
| Methods inherited from class com.threerings.puzzle.client.PuzzleBoardView |
|---|
abortAnimation, addActionAnimation, addActionSprite, animationFinished, clearAnimations, clearSprites, createScoreAnimation, createScoreAnimation, dumpActors, getActionAnimationCount, getActionCount, getActionSpriteCount, maybeFireCleared, paintBehind, paintInFront, removeSprite, renderBackground, renderBoard, setBackgroundImage, setController, setPaused, trackAvoidAnimation |
| Methods inherited from class com.threerings.media.VirtualMediaPanel |
|---|
addObscurerDirtyRegion, addViewTracker, adjustBoundsCenter, clearPathable, constrainToBounds, didTick, dirtyScreenRect, doLayout, findRootBounds, getViewBounds, paint, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeViewTracker, setBackground, setBounds, setFollowsPathable, setViewLocation, trackPathable, viewLocationDidChange |
| Methods inherited from class com.threerings.media.MediaPanel |
|---|
addAnimation, addObscurer, addObscurerDirtyRegions, addSprite, clipToDirtyRegion, createActionSpriteHandler, createGraphics, getAnimationManager, getComponent, getRegionManager, getSpriteManager, getTimeStamp, isManaged, isManaged, needsPaint, paint, paintBits, paintDirtyRect, removeObscurer, repaint, setOpaque, tick, willTick |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Color SCORE_COLOR
public static final Color CHAIN_COLOR
protected DropBoard _dboard
protected com.threerings.media.sprite.Sprite[] _pieces
protected boolean[] _moving
protected int _pwid
protected int _phei
protected int _roff
protected int _bwid
protected int _bhei
| Constructor Detail |
|---|
public DropBoardView(PuzzleContext ctx,
int pwid,
int phei)
| Method Detail |
|---|
public void init(GameConfig config)
init in class PuzzleBoardViewpublic int getPieceWidth()
public int getPieceHeight()
public void getPiecePosition(int col,
int row,
Point pos)
DropSprite to populate pos with the screen coordinates
in pixels at which a piece at (col, row) in the board should be drawn. Derived
classes may wish to override this method to allow specialized positioning of sprites.
public Dimension getPieceSegmentSize(int col,
int row,
int orient,
int len)
DropSprite to get the dimensions of the area that will be occupied by
rendering a piece segment of the given orientation and length whose bottom-leftmost corner
is at (col, row).
public void createPiece(int piece,
int sx,
int sy)
public void updatePiece(int sx,
int sy)
ImageSprite is
being used to display pieces. If createPieceSprite(int, int, int) is overridden to return a
non-ImageSprite, this method must also be customized.
public void updatePiece(int piece,
int sx,
int sy)
ImageSprite is
being used to display pieces. If createPieceSprite(int, int, int) is overridden to return a
non-ImageSprite, this method must also be customized.
public void createPiece(int piece,
int sx,
int sy,
int tx,
int ty,
long duration)
public com.threerings.media.sprite.Sprite movePiece(int sx,
int sy,
int tx,
int ty,
long duration)
protected void movePiece(com.threerings.media.sprite.Sprite piece,
int sx,
int sy,
int tx,
int ty,
long duration)
protected void pieceArrived(long tickStamp,
com.threerings.media.sprite.Sprite sprite,
int px,
int py)
protected boolean isMoving(int px,
int py)
movePiece(Sprite,int,int,int,int,long)).
public com.threerings.media.image.Mirage getPieceImage(int piece)
(0, 0) with
an orientation of DirectionCodes.NORTH. This serves as a convenience routine for those puzzles
that don't bother rendering their pieces differently when placed at different board
coordinates or in different orientations.
public abstract com.threerings.media.image.Mirage getPieceImage(int piece,
int col,
int row,
int orient)
public void setBoard(Board board)
PuzzleBoardView
setBoard in class PuzzleBoardView
public com.threerings.media.sprite.Sprite getPieceSprite(int xx,
int yy)
public void clearPieceSprite(int xx,
int yy)
public void clearPiece(int xx,
int yy)
public DropSprite createPieces(int col,
int row,
int[] pieces,
int dist)
public void dirtySegment(int dir,
int col,
int row,
int len)
(col, row).
public ScoreAnimation createScoreAnimation(String score,
Color color,
Font font)
score - the score text to display.color - the color of the text.font - the font.
public ScoreAnimation createScoreAnimation(String score,
Color color,
Font font,
int x,
int y,
int width,
int height)
score - the score text to display.color - the color of the text.font - the font to use.x - the left coordinate in board coordinates of the rectangle within which the score
is to be centered.y - the bottom coordinate in board coordinates of the rectangle within which the score
is to be centered.width - the width in board coordinates of the rectangle within which the score is to
be centered.height - the height in board coordinates of the rectangle within which the score is to
be centered.
protected com.threerings.media.sprite.Sprite createPieceSprite(int piece,
int px,
int py)
protected void centerRectInBoardRect(int bx,
int by,
int bwid,
int bhei,
int rwid,
int rhei,
Point pos)
pos with the most appropriate screen coordinates to center a
rectangle of the given width and height (in pixels) within the specified rectangle (in
board coordinates).
bx - the bounding rectangle's left board coordinate.by - the bounding rectangle's bottom board coordinate.bwid - the bounding rectangle's width in board coordinates.bhei - the bounding rectangle's height in board coordinates.rwid - the width of the rectangle to position in pixels.rhei - the height of the rectangle to position in pixels.pos - the point to populate with the rectangle's final position.
public void rotateDropBlock(DropBlockSprite sprite,
int orient)
public void paintBetween(Graphics2D gfx,
Rectangle dirtyRect)
paintBetween in class PuzzleBoardViewpublic Dimension getPreferredSize()
getPreferredSize in class JComponent
public boolean inBounds(int col,
int row)
protected void renderRisingPieces(Graphics2D gfx,
Rectangle dirtyRect)
protected void setRiseOffset(int y)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||