|
|||||||||
| 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
public abstract class PuzzleBoardView
The puzzle board view displays a view of a puzzle game.
| 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 com.threerings.media.animation.AnimationAdapter |
_actionAnimObs
Listens to our action animations and clears them when they're done. |
protected List<com.threerings.media.animation.Animation> |
_actionAnims
The action animations on the board. |
protected List<com.threerings.media.sprite.Sprite> |
_actionSprites
The action sprites on the board. |
protected com.threerings.media.animation.AnimationArranger |
_avoidArranger
Prevents certain animations from overlapping others. |
protected com.threerings.media.image.Mirage |
_background
Our background image. |
protected Board |
_board
The board data to be displayed. |
protected Rectangle |
_bounds
The board's bounding rectangle. |
protected PuzzleContext |
_ctx
Our client context. |
protected Label |
_pauseLabel
A label to show when the puzzle is paused. |
protected PuzzleController |
_pctrl
Our puzzle controller. |
protected int |
_scoreDist
The distance in pixels that score animations float. |
protected static int |
ACTION_CLEARED
|
protected static int |
ACTION_GOING
|
protected static int |
CLEAR_PENDING
|
protected static boolean |
DEBUG_ACTION
Temporary action debugging. |
protected static int |
DEFAULT_SCORE_DISTANCE
The default vertical distance to float score animations. |
| 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.media.MediaConstants |
|---|
ALL, BACK, FRONT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
PuzzleBoardView(PuzzleContext ctx)
Constructs a puzzle board view. |
|
| Method Summary | |
|---|---|
void |
abortAnimation(com.threerings.media.animation.Animation anim)
|
void |
addActionAnimation(com.threerings.media.animation.Animation anim)
Adds the given animation to the set of animations currently present on the board. |
void |
addActionSprite(com.threerings.media.sprite.Sprite sprite)
Adds the given sprite to the set of sprites currently present on the board. |
protected void |
animationFinished(com.threerings.media.animation.Animation anim)
Called when a potential action animation is finished. |
void |
clearAnimations()
|
void |
clearSprites()
|
protected ScoreAnimation |
createScoreAnimation(Label label,
int x,
int y)
Creates a score animation, allowing derived classes to use custom animations that are customized following a call to createScoreAnimation(String,Color,Font,int,int). |
ScoreAnimation |
createScoreAnimation(String score,
Color color,
Font font,
int x,
int y)
Creates and returns an animation displaying the given string with the specified parameters, floating it a short distance up the view. |
void |
dumpActors()
Dumps to the logs, a list of interesting sprites and animations currently active on the puzzle board. |
int |
getActionAnimationCount()
Returns the number of action animations on the board. |
int |
getActionCount()
Returns the count of action sprites and animations on the board. |
int |
getActionSpriteCount()
Returns the number of action sprites on the board. |
void |
init(GameConfig config)
Initializes the board with the board dimensions. |
protected void |
maybeFireCleared()
Fires a ACTION_CLEARED command if we have no remaining interesting sprites or
animations. |
void |
paintBehind(Graphics2D gfx,
Rectangle dirty)
|
void |
paintBetween(Graphics2D gfx,
Rectangle dirty)
|
protected void |
paintInFront(Graphics2D gfx,
Rectangle dirty)
|
void |
removeSprite(com.threerings.media.sprite.Sprite sprite)
|
protected void |
renderBackground(Graphics2D gfx,
Rectangle dirty)
Fills the background of the board with the background color. |
protected abstract void |
renderBoard(Graphics2D gfx,
Rectangle dirty)
Renders the board contents to the given graphics context. |
void |
setBackgroundImage(com.threerings.media.image.Mirage image)
Sets the background image displayed by the board view. |
void |
setBoard(Board board)
Sets the board to be displayed. |
void |
setController(PuzzleController pctrl)
Provides the board view with a reference to its controller so that it may communicate directly rather than by posting actions up the interface hierarchy which sometimes fails if the puzzle board view is hidden before we get a chance to post our actions. |
void |
setPaused(boolean paused)
Set whether this puzzle is paused or not. |
void |
trackAvoidAnimation(com.threerings.media.animation.Animation anim)
Positions the supplied animation so as to avoid any active animations previously registered with this method, and adds the animation to the list of animations to be avoided by any future avoid animations. |
| 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 |
|---|
protected PuzzleContext _ctx
protected PuzzleController _pctrl
protected Board _board
protected Rectangle _bounds
protected List<com.threerings.media.animation.Animation> _actionAnims
protected List<com.threerings.media.sprite.Sprite> _actionSprites
protected com.threerings.media.animation.AnimationArranger _avoidArranger
protected com.threerings.media.image.Mirage _background
protected Label _pauseLabel
protected int _scoreDist
protected com.threerings.media.animation.AnimationAdapter _actionAnimObs
protected static boolean DEBUG_ACTION
protected static final int ACTION_GOING
protected static final int CLEAR_PENDING
protected static final int ACTION_CLEARED
protected static final int DEFAULT_SCORE_DISTANCE
| Constructor Detail |
|---|
public PuzzleBoardView(PuzzleContext ctx)
| Method Detail |
|---|
public void init(GameConfig config)
public void setBoard(Board board)
public void setController(PuzzleController pctrl)
public void setBackgroundImage(com.threerings.media.image.Mirage image)
public void setPaused(boolean paused)
setPaused in class com.threerings.media.MediaPanelpublic void addActionAnimation(com.threerings.media.animation.Animation anim)
getActionAnimationCount(). The animation will automatically be removed from the
action list when it completes.
public void abortAnimation(com.threerings.media.animation.Animation anim)
abortAnimation in class com.threerings.media.MediaPanelprotected void animationFinished(com.threerings.media.animation.Animation anim)
public void addActionSprite(com.threerings.media.sprite.Sprite sprite)
getActionSpriteCount(). Callers should be sure to remove the sprite when their work
with it is done via removeSprite(com.threerings.media.sprite.Sprite).
public void removeSprite(com.threerings.media.sprite.Sprite sprite)
removeSprite in class com.threerings.media.MediaPanelpublic void clearSprites()
clearSprites in class com.threerings.media.MediaPanelpublic void clearAnimations()
clearAnimations in class com.threerings.media.MediaPanelpublic int getActionAnimationCount()
public int getActionSpriteCount()
public int getActionCount()
public void dumpActors()
public ScoreAnimation createScoreAnimation(String score,
Color color,
Font font,
int x,
int y)
score - the score text to display.color - the color of the text.font - the font with which to create the score animation.x - the x-position at which the score is to be placed.y - the y-position at which the score is to be placed.
protected ScoreAnimation createScoreAnimation(Label label,
int x,
int y)
createScoreAnimation(String,Color,Font,int,int).
public void trackAvoidAnimation(com.threerings.media.animation.Animation anim)
public void paintBehind(Graphics2D gfx,
Rectangle dirty)
paintBehind in class com.threerings.media.VirtualMediaPanel
protected void renderBackground(Graphics2D gfx,
Rectangle dirty)
public void paintBetween(Graphics2D gfx,
Rectangle dirty)
paintBetween in class com.threerings.media.MediaPanel
protected void paintInFront(Graphics2D gfx,
Rectangle dirty)
paintInFront in class com.threerings.media.MediaPanelprotected void maybeFireCleared()
ACTION_CLEARED command if we have no remaining interesting sprites or
animations.
protected abstract void renderBoard(Graphics2D gfx,
Rectangle dirty)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||