* this draws the actual piece.
*/
@Override
public void render( Graphics2D g2, BoardPosition position, int cellSize, int margin, Board b) {
CheckersPiece piece = (CheckersPiece)position.getPiece();
if (piece == null)
return; // nothing to render
int pieceSize = getPieceSize(cellSize, piece);
if ( piece.getType() == CheckersPiece.REGULAR_PIECE ) {
super.render( g2, position, cellSize, margin, b);
}
else { //draw a KING
g2.setColor( getPieceColor(piece) );
Point pos = getPosition(position, cellSize, pieceSize, margin);
g2.fillRect( pos.x, pos.y, pieceSize, pieceSize );
if ( piece.getTransparency() == 0 ) {
// black outline
g2.setColor( Color.black );
g2.drawRect( pos.x , pos.y, pieceSize + 1, pieceSize + 1 );
}
}