|
Cute Chess
0.1
|
A graphical surface for displaying a chessgame. More...
#include <boardscene.h>
Public Slots | |
| void | flip () |
| void | makeMove (const Chess::Move &move) |
| void | makeMove (const Chess::GenericMove &move) |
| void | onGameFinished (ChessGame *game, Chess::Result result) |
| void | populate () |
| void | setFenString (const QString &fenString) |
| void | undoMove () |
Signals | |
| void | humanMove (const Chess::GenericMove &move, const Chess::Side &side) |
Public Member Functions | |
| Chess::Board * | board () const |
| BoardScene (QObject *parent=nullptr) | |
| void | setBoard (Chess::Board *board) |
| virtual | ~BoardScene () |
Protected Member Functions | |
| virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) |
| virtual void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
| virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) |
Additional Inherited Members | |
Public Types inherited from QGraphicsScene | |
| enum | ItemIndexMethod |
| enum | SceneLayer |
A graphical surface for displaying a chessgame.
BoardScene is the top-level container for the board, the chess pieces, etc. It also manages the deletion and creation of pieces, visualising moves made in a game, emitting moves made by a human player, etc.
BoardScene is that class that connects to the players and game objects to synchronize the graphical side with the internals.
|
explicit |
Creates a new BoardScene object.
|
virtual |
Destroys the scene and all its items.
| Chess::Board * BoardScene::board | ( | ) | const |
Returns the current internal board object.
|
slot |
Flips the board, with animation.
|
signal |
This signal is emitted when a human player has made a move.
The move is guaranteed to be legal. The move was made by the player on side side.
|
slot |
Makes the move move in the scene.
|
slot |
Makes the move move in the scene.
|
slot |
Cancels any ongoing user move and flashes result over the board.
|
slot |
Clears the scene, creates a new board, and populates it with chess pieces.
The scene is populated to match the current FEN string of the internal board, so the internal board must be fully initialized before calling this function.
| void BoardScene::setBoard | ( | Chess::Board * | board | ) |
Clears the scene and sets board as the internal board.
The scene takes ownership of the board, so it's usually best to give the scene its own copy of a board.
|
slot |
Re-populates the scene according to fenString.
|
slot |
Reverses the last move that was made in the scene.
1.8.11