|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgame.PieceViz
public abstract class PieceViz
This class is responsible for displaying graphics associated with game pieces in the graphics panel. The separation of the piece's behavior from its visual representation keeps each part simpler and makes things more flexible.
| Field Summary | |
|---|---|
protected nip.GraphicsPanel |
panel
|
protected Piece |
piece
|
| Constructor Summary | |
|---|---|
PieceViz(Piece piece,
java.awt.Color c,
nip.GraphicsPanel panel)
|
|
| Method Summary | |
|---|---|
boolean |
isDead()
Subscribers must be able to say when they are still alive or are dead. |
protected abstract nip.Graphic |
newGraphic()
Implemented by subclasses to provide a new graphic that represents the piece. |
protected abstract boolean |
newSize()
Implemented by subclasses to report whenever the piece changes in size. |
void |
observeEvent(PieceEvent pe)
Called whenever the Piece position or status changes and updates the graphic accordingly. |
protected void |
setGraphic(nip.Graphic graphic)
Set the Shape for this visualization of a Piece. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final nip.GraphicsPanel panel
protected final Piece piece
| Constructor Detail |
|---|
public PieceViz(Piece piece,
java.awt.Color c,
nip.GraphicsPanel panel)
| Method Detail |
|---|
protected void setGraphic(nip.Graphic graphic)
graphic - is the new graphic to be used to
represent the piece.protected abstract boolean newSize()
protected abstract nip.Graphic newGraphic()
public void observeEvent(PieceEvent pe)
observeEvent in interface Subscriber<PieceEvent>pe - is the event associated with the piecepublic boolean isDead()
Subscriber
isDead in interface Subscriber<PieceEvent>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||