From fdab451352d7de558132848807f4dac6fb22e60d Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 29 Dec 2022 13:00:23 +0100 Subject: Improve piece animation code --- src/game_tab/left_panel/board/BoardCanvas.hpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/game_tab/left_panel/board/BoardCanvas.hpp') diff --git a/src/game_tab/left_panel/board/BoardCanvas.hpp b/src/game_tab/left_panel/board/BoardCanvas.hpp index eeff44d..36e1cf2 100644 --- a/src/game_tab/left_panel/board/BoardCanvas.hpp +++ b/src/game_tab/left_panel/board/BoardCanvas.hpp @@ -40,6 +40,19 @@ wxDECLARE_EVENT(NEXT_MOVE_EVENT, wxCommandEvent); typedef std::tuple ClockTime; +// Drawing buffer (ANIMATIONS) +typedef struct AnimState { + wxBitmap *buffer; + bool reuseBuffer; + int frame,duration,fps,duration_fast; + std::string final_board; + bool final_is_black_turn; + std::map final_captures; + char piece_moved; + wxPoint src; + wxPoint transVect; +} AnimState; + class BoardCanvas : public wxPanel { // *t is theme for board+pieces and // *t_captures is theme for captured pieces (scale down version of t) @@ -57,16 +70,7 @@ class BoardCanvas : public wxPanel { ClockTime black_time, white_time; bool frozen,lock_square_size; - // Drawing buffer (ANIMATIONS) - wxBitmap *buffer; - bool reuseBuffer; - int frame,duration,fps,duration_fast; - std::string final_board; - bool final_is_black_turn; - std::map final_captures; - char piece_moved; - wxPoint src; - wxPoint transVect; + AnimState adata; public: BoardCanvas(wxFrame *parent); -- cgit v1.2.3