|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--VASSAL.counters.BasicPiece
Basic class for representing a physical component of the game Can be a counter, a card, or an overlay
| Field Summary | |
static java.lang.String |
ID
|
protected java.awt.Image |
image
|
protected java.awt.Rectangle |
imageBounds
|
protected java.lang.String |
imageName
|
protected javax.swing.JPopupMenu |
popup
|
static java.awt.Font |
POPUP_MENU_FONT
|
| Constructor Summary | |
BasicPiece()
|
|
BasicPiece(java.lang.String type)
|
|
| Method Summary | |
java.awt.Rectangle |
boundingBox()
The area which this GamePiece occupies when drawn at the point (0,0) |
void |
draw(java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
Draw this GamePiece |
boolean |
equals(GamePiece c)
|
java.lang.String |
getDescription()
A plain-English description of this type of piece |
PieceEditor |
getEditor()
Get the configurer for this trait |
HelpFile |
getHelpFile()
|
static Highlighter |
getHighlighter()
Get the Highlighter instance for drawing selected pieces. |
java.lang.String |
getId()
Each GamePiece must have a unique String identifier |
protected KeyCommand[] |
getKeyCommands()
|
Map |
getMap()
|
java.lang.String |
getName()
The plain English name for this piece |
Stack |
getParent()
|
java.awt.Point |
getPosition()
|
java.lang.Object |
getProperty(java.lang.Object key)
|
java.awt.Shape |
getShape()
The shape of the piece from the user's viewpoint. |
java.lang.String |
getState()
The state information is information that can change during the course of a game. |
java.lang.String |
getType()
The type information is information that does not change during the course of a game. |
Command |
keyEvent(javax.swing.KeyStroke stroke)
Keyboard events are forward to this method when a piece is selected The GamePiece can respond in any way it likes |
void |
mySetType(java.lang.String type)
Set the type information for this piece. |
protected java.lang.Object |
prefsValue(java.lang.String s)
|
static void |
setHighlighter(Highlighter h)
Set the Highlighter for all pieces |
void |
setId(java.lang.String id)
|
void |
setMap(Map map)
Each GamePiece belongs to a single Map |
void |
setParent(Stack s)
|
void |
setPosition(java.awt.Point p)
|
void |
setProperty(java.lang.Object key,
java.lang.Object val)
Other properties, possibly game-specific, can be associated with a piece. |
void |
setState(java.lang.String s)
|
void |
showPopup(java.awt.event.MouseEvent e)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String ID
public static java.awt.Font POPUP_MENU_FONT
protected java.awt.Image image
protected java.awt.Rectangle imageBounds
protected javax.swing.JPopupMenu popup
protected java.lang.String imageName
| Constructor Detail |
public BasicPiece()
public BasicPiece(java.lang.String type)
| Method Detail |
public void mySetType(java.lang.String type)
EditablePieceDecorator.myGetType()mySetType in interface EditablePiecepublic java.lang.String getType()
GamePiecegetType in interface GamePieceVASSAL.counters.GamePieceBasicCommandEncoderpublic void setMap(Map map)
GamePieceMapsetMap in interface GamePiecepublic Map getMap()
getMap in interface GamePiecepublic java.lang.Object getProperty(java.lang.Object key)
getProperty in interface GamePiece
public void setProperty(java.lang.Object key,
java.lang.Object val)
GamePieceGamePiece.getState() method.setProperty in interface GamePieceprotected java.lang.Object prefsValue(java.lang.String s)
public void draw(java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
GamePiecedraw in interface GamePieceVASSAL.counters.GamePieceg - x - x-location of the center of the piecey - y-location of the center of the pieceobs - the Component on which this piece is being drawnzoom - the scaling factor.protected KeyCommand[] getKeyCommands()
public java.awt.Point getPosition()
getPosition in interface GamePieceVASSAL.counters.GamePieceMappublic void setPosition(java.awt.Point p)
setPosition in interface GamePiecepublic Stack getParent()
getParent in interface GamePieceVASSAL.counters.GamePieceStack to which this piece belongs, or null if it doesn't belong to a stack.public void setParent(Stack s)
setParent in interface GamePiecepublic java.awt.Rectangle boundingBox()
GamePieceboundingBox in interface GamePiecepublic java.awt.Shape getShape()
GamePieceGamePiece.boundingBox(), it assumes the position is (0,0) and must be translated
to the actual location where the piece is being drawn.getShape in interface GamePiecepublic boolean equals(GamePiece c)
public java.lang.String getName()
GamePiecegetName in interface GamePiecepublic Command keyEvent(javax.swing.KeyStroke stroke)
GamePiecekeyEvent in interface GamePieceVASSAL.counters.GamePieceCommand that, when executed, will invoke
the same response. Usually a ChangePiece command.ForwardToKeyBufferpublic void showPopup(java.awt.event.MouseEvent e)
public java.lang.String getState()
GamePiecegetState in interface GamePiecepublic void setState(java.lang.String s)
setState in interface GamePiecepublic java.lang.String getId()
GamePiecegetId in interface GamePieceVASSAL.counters.GamePieceGameState.getNewPieceId()public void setId(java.lang.String id)
setId in interface GamePiecepublic static Highlighter getHighlighter()
public static void setHighlighter(Highlighter h)
public java.lang.String getDescription()
EditablePiecegetDescription in interface EditablePiecepublic HelpFile getHelpFile()
getHelpFile in interface EditablePiecepublic PieceEditor getEditor()
EditablePiecegetEditor in interface EditablePiece
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||