aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-11 13:04:52 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-11 13:04:52 +0100
commitafcb0d4ed194fa1453cabcf664dfea4b1587ab01 (patch)
tree85639fbe11a4d5d99b9b09bf5fc6d470606d78a1
parentea180c20265de35b654f37c400e119a71249d751 (diff)
Debug arrows drawing
-rw-r--r--src/game_tab/left_panel/GameTabLeftPanel.cpp6
-rw-r--r--src/game_tab/left_panel/board/BoardCanvas.cpp8
2 files changed, 8 insertions, 6 deletions
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp
index c4d8764..1d6ed61 100644
--- a/src/game_tab/left_panel/GameTabLeftPanel.cpp
+++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp
@@ -89,13 +89,13 @@ void GameTabLeftPanel::SetEngineEvaluation(EngineEvaluation eval){
if(is_engine_on){
engine_arrows.clear();
float scale=1;
- unsigned char color=0;
+ unsigned char alpha=190;
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});
+ engine_arrows.push_back({src,dst,wxColour(6,57,112,alpha),scale});
scale=std::max(0.1,scale-0.25);
- color=std::min(255,color+70);
+ alpha=std::max(20,alpha-60);
}
eval_cp=eval.eval;
Notify(true);
diff --git a/src/game_tab/left_panel/board/BoardCanvas.cpp b/src/game_tab/left_panel/board/BoardCanvas.cpp
index 97ca3ad..7fc9d10 100644
--- a/src/game_tab/left_panel/board/BoardCanvas.cpp
+++ b/src/game_tab/left_panel/board/BoardCanvas.cpp
@@ -667,10 +667,11 @@ void BoardCanvas::DrawLArrow(wxDC &dc, int xsrc, int ysrc, int xdst, int ydst, b
// Compute metrics
double tip_height=sqrt(3)/2*thickness;
double yoffset=Y<0 ? -thickness/4 : thickness/4; // Y tail should be longer to form a right angle (corner of tail joins)
+ double xoffset=X<0 ? -thickness/4 : thickness/4; // X tail's starting point should be translated to form a right angle (corner of tail joins)
if(X<0){tip_height=-tip_height;}
wxPoint tip[]={wxPoint(X-tip_height,-thickness/2+Y),wxPoint(X,Y),wxPoint(X-tip_height,thickness/2+Y)};
wxPoint tail1[]={wxPoint(-thickness/4,0),wxPoint(thickness/4,0),wxPoint(thickness/4,Y+yoffset),wxPoint(-thickness/4,Y+yoffset)};
- wxPoint tail2[]={wxPoint(0,Y-thickness/4),wxPoint(X-tip_height,Y-thickness/4),wxPoint(X-tip_height,Y+thickness/4),wxPoint(0,Y+thickness/4)};
+ wxPoint tail2[]={wxPoint(xoffset,Y-thickness/4),wxPoint(X-tip_height,Y-thickness/4),wxPoint(X-tip_height,Y+thickness/4),wxPoint(xoffset,Y+thickness/4)};
// Apply transforms
TRANS2(tip[0]);TRANS2(tip[1]);TRANS2(tip[2]);
@@ -685,11 +686,12 @@ void BoardCanvas::DrawLArrow(wxDC &dc, int xsrc, int ysrc, int xdst, int ydst, b
} else {
// Compute metrics
double tip_height=sqrt(3)/2*thickness;
- double xoffset=X<0 ? -thickness/4 : thickness/4; // Y tail should be longer to form a right angle (corner of tail joins)
+ double xoffset=X<0 ? -thickness/4 : thickness/4; // X tail should be longer to form a right angle (corner of tail joins)
+ double yoffset=Y<0 ? -thickness/4 : thickness/4; // Y tail's starting point should be translated to form a right angle (corner of tail joins)
if(Y<0){tip_height=-tip_height;}
wxPoint tip[]={wxPoint(-thickness/2 + X,Y-tip_height),wxPoint(thickness/2 + X ,Y-tip_height),wxPoint(X,Y)};
wxPoint tail1[]={wxPoint(0,-thickness/4),wxPoint(X+xoffset,-thickness/4),wxPoint(X+xoffset,thickness/4),wxPoint(0,thickness/4)};
- wxPoint tail2[]={wxPoint(X-thickness/4,0),wxPoint(X+thickness/4,0),wxPoint(X+thickness/4,Y-tip_height),wxPoint(X-thickness/4,Y-tip_height)};
+ wxPoint tail2[]={wxPoint(X-thickness/4,yoffset),wxPoint(X+thickness/4,yoffset),wxPoint(X+thickness/4,Y-tip_height),wxPoint(X-thickness/4,Y-tip_height)};
// Apply transforms
TRANS2(tip[0]);TRANS2(tip[1]);TRANS2(tip[2]);