diff options
Diffstat (limited to 'src/game_tab/left_panel/GameTabLeftPanel.cpp')
| -rw-r--r-- | src/game_tab/left_panel/GameTabLeftPanel.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp index 5a1ae44..c4d8764 100644 --- a/src/game_tab/left_panel/GameTabLeftPanel.cpp +++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp @@ -2,7 +2,7 @@ #include <wx/clipbrd.h> GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr<Game> game) - : TabGameLeftPanel(parent), game(game), repeat(false) { + : TabGameLeftPanel(parent), game(game), repeat(false), is_engine_on(false) { // Configure toolbar (note that toolbar events are processed into the GameTab class) game_toolbar->AddTool(0, wxT("Save As"), @@ -86,20 +86,32 @@ void GameTabLeftPanel::OnPlay(wxCommandEvent &event) { } void GameTabLeftPanel::SetEngineEvaluation(EngineEvaluation eval){ - engine_arrows.clear(); - float scale=1; - unsigned char color=0; - for(auto const &arrow: eval.best_lines){ - std::string src=arrow.substr(0,2); - std::string dst=arrow.substr(2,2); - engine_arrows.push_back({src,dst,wxColour(color,color,color),scale}); - scale=std::max(0.1,scale-0.25); - color=std::min(255,color+70); + if(is_engine_on){ + engine_arrows.clear(); + float scale=1; + unsigned char color=0; + for(auto const &arrow: eval.best_lines){ + std::string src=arrow.substr(0,2); + std::string dst=arrow.substr(2,2); + engine_arrows.push_back({src,dst,wxColour(color,color,color),scale}); + scale=std::max(0.1,scale-0.25); + color=std::min(255,color+70); + } + eval_cp=eval.eval; + Notify(true); } - eval_cp=eval.eval; - Notify(true); } +void GameTabLeftPanel::SetLiveEngineState(bool isOn){ + is_engine_on=isOn; + if(!is_engine_on){ + engine_arrows.clear(); + eval_cp=0; + Notify(true); + } +} + + void GameTabLeftPanel::Notify(bool skip_animation) { // Update fen and captures std::string fen = game->GetFen(); @@ -138,7 +150,7 @@ void GameTabLeftPanel::Notify(bool skip_animation) { gs.mat_white=game->IsCheckmate(false); gs.arrows=engine_arrows; gs.promotion=promote_on; - gs.show_evalbar=engine_arrows.size()>0; + gs.show_evalbar=is_engine_on; gs.eval=eval_cp/100; if(m){ // There should be a valid src_hl or dst_hl ortherwise it explode: |
