|
Cute Chess
0.1
|
A graphical reserve for captured chess pieces. More...
#include <graphicspiecereserve.h>
Public Types | |
| enum | { Type = UserType + 3 } |
Public Types inherited from QGraphicsItem | |
| enum | CacheMode |
| enum | Extension |
| enum | GraphicsItemFlag |
Public Member Functions | |
| void | addPiece (GraphicsPiece *piece) |
| virtual QRectF | boundingRect () const |
| GraphicsPieceReserve (qreal squareSize, QGraphicsItem *parent=nullptr) | |
| virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) |
| GraphicsPiece * | piece (const Chess::Piece &piece) const |
| int | pieceCount (const Chess::Piece &piece) const |
| GraphicsPiece * | takePiece (const Chess::Piece &piece) |
| virtual int | type () const |
A graphical reserve for captured chess pieces.
Some chess variants like Crazyhouse have a reserve for captured pieces which can be brought back to the game. This class acts as a kind of separate chessboard for the piece reserve.
| anonymous enum |
The type value returned by type().
|
explicit |
Creates a new piece reserve.
Each "square" has a width and height of squareSize, and squares are automatically added and removed when needed.
| void GraphicsPieceReserve::addPiece | ( | GraphicsPiece * | piece | ) |
Adds piece to the reserve. This object becomes the parent item and container of piece.
| GraphicsPiece * GraphicsPieceReserve::piece | ( | const Chess::Piece & | piece | ) | const |
Returns a GraphicsPiece object of type piece. Returns 0 if no pieces of type piece exist.
| int GraphicsPieceReserve::pieceCount | ( | const Chess::Piece & | piece | ) | const |
Returns the number of pieces of type piece.
| GraphicsPiece * GraphicsPieceReserve::takePiece | ( | const Chess::Piece & | piece | ) |
Removes a GraphicsPiece of type piece and returns it. Returns 0 if no pieces of type exist.
1.8.11