Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show change of winrate bar #897

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Simplify style of "change of winrate bar"
  • Loading branch information
Hiraoka committed Sep 8, 2021
commit 8ffda31791e9ca2cd7511ffaad39b02956ee993a
7 changes: 2 additions & 5 deletions src/main/java/featurecat/lizzie/gui/LizzieFrame.java
Original file line number Diff line number Diff line change
@@ -1032,15 +1032,12 @@ private void drawMoveStatistics(Graphics2D g, int posX, int posY, int width, int

// Draw change of winrate bars
if (validWinrate && validLastWinrate) {
double gain = 100 - lastWR - curWR;
double blackLastWR = Lizzie.board.getData().blackToPlay ? 100 - lastWR : lastWR;
int lastPosxW = barPosxB + (int) (blackLastWR * maxBarwidth / 100);
int diffPosX = Math.min(barPosxW, lastPosxW);
int diffWidth = Math.abs(barPosxW - lastPosxW);
Stroke oldstroke = g.getStroke();
g.setStroke(new BasicStroke(strokeRadius));
g.setColor(gain >= 0 ? Color.GREEN : Color.RED);
g.drawRect(diffPosX, barPosY, diffWidth, barHeight);
g.setColor(Color.GRAY);
g.drawLine(lastPosxW, barPosY, lastPosxW, barPosY + barHeight);
g.setStroke(oldstroke);
}

7 changes: 2 additions & 5 deletions src/main/java/featurecat/lizzie/gui/WinratePane.java
Original file line number Diff line number Diff line change
@@ -253,15 +253,12 @@ private void drawMoveStatistics(Graphics2D g, int posX, int posY, int width, int

// Draw change of winrate bars
if (validWinrate && validLastWinrate) {
double gain = 100 - lastWR - curWR;
double blackLastWR = Lizzie.board.getData().blackToPlay ? 100 - lastWR : lastWR;
int lastPosxW = barPosxB + (int) (blackLastWR * maxBarwidth / 100);
int diffPosX = Math.min(barPosxW, lastPosxW);
int diffWidth = Math.abs(barPosxW - lastPosxW);
Stroke oldstroke = g.getStroke();
g.setStroke(new BasicStroke(strokeRadius));
g.setColor(gain >= 0 ? Color.GREEN : Color.RED);
g.drawRect(diffPosX, barPosY, diffWidth, barHeight);
g.setColor(Color.GRAY);
g.drawLine(lastPosxW, barPosY, lastPosxW, barPosY + barHeight);
g.setStroke(oldstroke);
}