mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +02:00
Debug arrows drawing
This commit is contained in:
parent
ea180c2026
commit
afcb0d4ed1
2 changed files with 8 additions and 6 deletions
|
@ -89,13 +89,13 @@ void GameTabLeftPanel::SetEngineEvaluation(EngineEvaluation eval){
|
||||||
if(is_engine_on){
|
if(is_engine_on){
|
||||||
engine_arrows.clear();
|
engine_arrows.clear();
|
||||||
float scale=1;
|
float scale=1;
|
||||||
unsigned char color=0;
|
unsigned char alpha=190;
|
||||||
for(auto const &arrow: eval.best_lines){
|
for(auto const &arrow: eval.best_lines){
|
||||||
std::string src=arrow.substr(0,2);
|
std::string src=arrow.substr(0,2);
|
||||||
std::string dst=arrow.substr(2,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);
|
scale=std::max(0.1,scale-0.25);
|
||||||
color=std::min(255,color+70);
|
alpha=std::max(20,alpha-60);
|
||||||
}
|
}
|
||||||
eval_cp=eval.eval;
|
eval_cp=eval.eval;
|
||||||
Notify(true);
|
Notify(true);
|
||||||
|
|
|
@ -667,10 +667,11 @@ void BoardCanvas::DrawLArrow(wxDC &dc, int xsrc, int ysrc, int xdst, int ydst, b
|
||||||
// Compute metrics
|
// Compute metrics
|
||||||
double tip_height=sqrt(3)/2*thickness;
|
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 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;}
|
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 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 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
|
// Apply transforms
|
||||||
TRANS2(tip[0]);TRANS2(tip[1]);TRANS2(tip[2]);
|
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 {
|
} else {
|
||||||
// Compute metrics
|
// Compute metrics
|
||||||
double tip_height=sqrt(3)/2*thickness;
|
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;}
|
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 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 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
|
// Apply transforms
|
||||||
TRANS2(tip[0]);TRANS2(tip[1]);TRANS2(tip[2]);
|
TRANS2(tip[0]);TRANS2(tip[1]);TRANS2(tip[2]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue