April 2018
Beginner
714 pages
18h 21m
English
Now that we can see the board, it is time to put the pieces on it. We will use images for that purpose. In my case, we found a number of SVG files with chess pieces and decided to use them. SVG is a vector graphics format where all curves are defined not as a fixed set of points but as mathematic curves. Their main benefit is that they scale very well without causing an aliasing effect.
Let's equip our view with a registry of images to be used for "stamping" a particular piece type. Since each piece type is identified with char, we can use it to generate keys for a map of images. Let's put the following API into ChessView:
public: void setPiece(char type, const QIcon &icon); QIcon piece(char type) const; ...
Read now
Unlock full access