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 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 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: