diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-01 19:05:15 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-01 19:05:15 +0100 |
| commit | bbf3282839eb9efe57b1451763ef0859198c33af (patch) | |
| tree | 38a388bb23d9cf7dbc2b768c0613557a66419cda /src/game_tab/left_panel | |
| parent | 4e85af5e08b86fb32d6698836f3a227bc6f086b3 (diff) | |
Update Game tab
Diffstat (limited to 'src/game_tab/left_panel')
| -rw-r--r-- | src/game_tab/left_panel/GameTabLeftPanel.cpp | 9 | ||||
| -rw-r--r-- | src/game_tab/left_panel/GameTabLeftPanel.hpp | 5 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp index e986653..1142e99 100644 --- a/src/game_tab/left_panel/GameTabLeftPanel.cpp +++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp @@ -21,7 +21,6 @@ GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr<Game> game) // Configure FEN field fen_text_field->SetFont(wxFont(*wxNORMAL_FONT).Bold().Larger()); - last_move=game->GetCurrentMove(); // Bind events: Bind(PLAY_MOVE_EVENT, &GameTabLeftPanel::OnPlay, this, wxID_ANY); @@ -68,6 +67,7 @@ void GameTabLeftPanel::OnPlay(wxCommandEvent &event) { event.SetEventObject(this); ProcessEvent(event); } + Notify(true); } void GameTabLeftPanel::Notify(bool skip_animation) { @@ -78,12 +78,13 @@ void GameTabLeftPanel::Notify(bool skip_animation) { bool animate=false; HalfMove *m = game->GetCurrentMove(); std::string src,dst; - if (m) + if (m){ captures = m->GetLineCaptures(); + } // Update board canvas: - if(!skip_animation || animate){ + if(skip_animation || !animate){ board_canvas->SetupBoard(chessarbiter::FENParser::Parse(fen).board, game->IsBlackToPlay(), captures, game->GetTag("White"),game->GetTag("Black")); @@ -92,8 +93,6 @@ void GameTabLeftPanel::Notify(bool skip_animation) { board_canvas->Animate(chessarbiter::FENParser::Parse(fen).board, game->IsBlackToPlay(), captures,src,dst,repeat); } - // Update last move - last_move=m; // Update fen field: fen_text_field->SetValue(game->GetFen()); } diff --git a/src/game_tab/left_panel/GameTabLeftPanel.hpp b/src/game_tab/left_panel/GameTabLeftPanel.hpp index 5073e9c..359b815 100644 --- a/src/game_tab/left_panel/GameTabLeftPanel.hpp +++ b/src/game_tab/left_panel/GameTabLeftPanel.hpp @@ -11,10 +11,9 @@ wxDECLARE_EVENT(GAME_CHANGE, wxCommandEvent); class GameTabLeftPanel : public TabGameLeftPanel { std::shared_ptr<Game> game; BoardCanvas *board_canvas; - std::string last_absolute_move; bool repeat; - HalfMove *last_move; - + std::string last_absolute_move; + public: GameTabLeftPanel(wxFrame *parent, std::shared_ptr<Game> game); void Notify(bool skip_animation=false); |
