aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-12-29 13:24:23 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-12-29 13:24:23 +0100
commit796ba531eac19a6032000ef9b2faa79c89c84188 (patch)
tree61d2deddade2781024f7fcc46e3ae3d907090625
parentf04f9b701942d7fe6c9cc0eeb6b7d711577f7db0 (diff)
Cleaning code
-rw-r--r--src/MainWindow.cpp4
-rw-r--r--src/game_tab/left_panel/board/BoardCanvas.cpp2
-rw-r--r--src/game_tab/left_panel/board/BoardCanvas.hpp18
3 files changed, 20 insertions, 4 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 344b249..39a9401 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -58,8 +58,8 @@ MainWindow::MainWindow()
// Temporary TO REMOVE JUST FOR TESTS:
- BaseTab *bt = new BaseTab((wxFrame *)notebook, "/home/loic/pgn/twic1467.pgn");
- this->AddPage(bt,bt);
+ //BaseTab *bt = new BaseTab((wxFrame *)notebook, "/home/loic/pgn/twic1467.pgn");
+ //this->AddPage(bt,bt);
}
void MainWindow::AddPage(wxWindow* window, TabInfos* infos){
diff --git a/src/game_tab/left_panel/board/BoardCanvas.cpp b/src/game_tab/left_panel/board/BoardCanvas.cpp
index f0cf1c5..de9fac7 100644
--- a/src/game_tab/left_panel/board/BoardCanvas.cpp
+++ b/src/game_tab/left_panel/board/BoardCanvas.cpp
@@ -64,7 +64,7 @@ void BoardCanvas::OnPaint(wxPaintEvent &event) {
dc.Blit(0,0,canvas_size.x,canvas_size.y,(wxDC*)&memDC,0,0);
}
else {
- // Otherwise reuse buffer and animate. TEST CODE FOR NOW:
+ // Otherwise reuse buffer and animate
dc.DrawBitmap(*adata.buffer, 0, 0, true);
double percent=adata.frame/adata.frames;
// Draw moving piece
diff --git a/src/game_tab/left_panel/board/BoardCanvas.hpp b/src/game_tab/left_panel/board/BoardCanvas.hpp
index d4e4717..2f459c5 100644
--- a/src/game_tab/left_panel/board/BoardCanvas.hpp
+++ b/src/game_tab/left_panel/board/BoardCanvas.hpp
@@ -42,14 +42,29 @@ typedef std::tuple<short, short, short> ClockTime;
// Drawing buffer (ANIMATIONS)
typedef struct AnimState {
+ /// @brief Temporary buffer to reduce latency
wxBitmap *buffer;
+ /// @brief Should *buffer be used?
bool reuseBuffer;
- int frame,frames,duration,fps,duration_fast;
+ /// @brief Current animated frame
+ int frame;
+ /// @brief Total number of frames for the animation
+ int frames;
+ /// @brief Animation durations (in ms)
+ int duration,duration_fast;
+ /// @brief Animation FPS
+ std::uint8_t fps;
+ /// @brief Board to draw at the end of the animation
std::string final_board;
+ /// @brief Which player is to move at the end of the animation
bool final_is_black_turn;
+ /// @brief Final state of captured pieces at the end of the animation
std::map<char, std::uint8_t> final_captures;
+ /// @brief Current animated piece
char piece_moved;
+ /// @brief Starting point of the animated piece
wxPoint src;
+ /// @brief Translation vector of the animated piece
wxPoint transVect;
} AnimState;
@@ -70,6 +85,7 @@ class BoardCanvas : public wxPanel {
ClockTime black_time, white_time;
bool frozen,lock_square_size;
+ // Current animation state
AnimState adata;
public: