public abstract class DropBoardView extends PuzzleBoardView implements DropPieceCodes
com.threerings.media.MediaPanel.ObscurerJComponent.AccessibleJComponentComponent.BaselineResizeBehavior| Modifier and Type | Field and Description |
|---|---|
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.
|
CENTER_ON_PATHABLE, ENCLOSE_PATHABLE, TRACK_PATHABLETOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDROP_BLOCK_PIECE_COUNT, PIECE_NONECARDINAL_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, WESTSOUTHWESTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
DropBoardView(PuzzleContext ctx,
int pwid,
int phei)
Constructs a drop board view.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.
|
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.
|
void |
paintBetween(Graphics2D gfx,
Rectangle dirtyRect) |
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.
|
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.
|
abortAnimation, addActionAnimation, addActionSprite, clearAnimations, clearSprites, createScoreAnimation, dumpActors, getActionAnimationCount, getActionCount, getActionSpriteCount, paintBehind, removeSprite, setBackgroundImage, setController, setPaused, trackAvoidAnimationaddViewTracker, clearPathable, doLayout, getViewBounds, removeViewTracker, setBackground, setBounds, setFollowsPathable, setViewLocationaddAnimation, addObscurer, addSprite, createGraphics, getAnimationManager, getComponent, getRegionManager, getSpriteManager, getTimeStamp, isManaged, isManaged, needsPaint, paint, removeObscurer, repaint, setOpaque, tickaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIadd, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validateaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final Color SCORE_COLOR
public static final Color CHAIN_COLOR
public DropBoardView(PuzzleContext ctx, int pwid, int phei)
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)
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)
PuzzleBoardViewsetBoard in class PuzzleBoardViewpublic 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.public void rotateDropBlock(DropBlockSprite sprite, int orient)
public void paintBetween(Graphics2D gfx, Rectangle dirtyRect)
paintBetween in class PuzzleBoardViewpublic Dimension getPreferredSize()
getPreferredSize in class JComponentpublic boolean inBounds(int col,
int row)
Copyright © 2015. All rights reserved.