![]() |
OChess v0.0.2
Programmer's Manual
|
This class draws the chess board (squares, pieces, arrows and every other board related components). More...
#include <BoardCanvas.hpp>
Public Member Functions | |
| BoardCanvas (wxFrame *parent) | |
| BoardCanvas (wxFrame *parent, std::uint32_t square_width, bool frozen) | |
| void | ApplyPreferences () |
| void | DrawBoard (wxDC &dc) |
| Draw current board state BoardCanvas::gs on the given wxDC. | |
| void | OnPaint (wxPaintEvent &event) |
| Callback called by wxWidgets to refresh the canvas. | |
| void | MouseEvent (wxMouseEvent &event) |
| Callback called by wxWidgets to handle mouse events. More... | |
| void | Zoom (std::int32_t zoom) |
| Zomm in/out on the canvas. | |
| void | Swap () |
| Change between black side and white side. | |
| void | SetupBoard (const GameState &new_gs) |
| Display a position on the canvas. | |
| void | Animate (const GameState &new_gs, const std::string &src, const std::string &dst, bool faster) |
| Animate a piece front src to dst from current position. | |
| void | SetClockTime (short hours, short min, short sec, bool IsBlack) |
| Setup clock on displayed on the canvas. | |
Private Attributes | |
| Theme * | t |
| Contains the theme for squares and pieces (see Theme) | |
| Theme * | t_captures |
| Scale down version of BoardCanvas::t for the captured pieces by black and white. | |
| wxColour | color_arrows |
| Stores the color of the arrows. | |
| int | arrows_offset |
| Offset used for the start point of the arrows (this way, arrows do not completely overlap on the pieces) | |
| std::uint8_t | arrow_thickness |
| Thickness of the arrows. | |
| std::string | white_player |
| Player names. | |
| std::string | black_player |
| std::vector< GameState::Square > | squares_hl |
| Current highlighted squares that were highlighted with the mouse. | |
| std::vector< GameState::Arrow > | arrows |
| Current drawn arrows that were drawn with the mouse. | |
| bool | black_side |
| bool | is_dragging |
| bool | valid_drag |
| bool | arrow_drag |
| bool | is_black_turn |
| std::int32_t | boardX |
| std::int32_t | boardY |
| std::int32_t | square_width |
| std::int32_t | piece_width |
| std::int32_t | mouseX |
| std::int32_t | mouseY |
| std::int32_t | lastClickX |
| std::int32_t | lastClickY |
| wxSize | canvas_size |
| Contains an up to date dimension of the canvas size and its use in various places. | |
| wxPoint | active_square |
| Used for drag and drop. | |
| std::map< char, std::uint8_t > | captures |
| bool | frozen |
| Board can be frozen (to preview the board themes in the preference menu for example) | |
| bool | lock_square_size |
| AnimState | adata |
| Current animation state. | |
| GameState | gs |
| Current board state (contains all the game state) | |
This class draws the chess board (squares, pieces, arrows and every other board related components).
| void BoardCanvas::MouseEvent | ( | wxMouseEvent & | event | ) |
Callback called by wxWidgets to handle mouse events.
Play the move