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

Add setting to hide status text #324

Merged
merged 1 commit into from
Jul 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions src/main/java/featurecat/lizzie/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Config {
public boolean showRawBoard = false;
public boolean handicapInsteadOfWinrate = false;

public boolean showStatus = true;
public boolean showBranch = true;
public boolean showBestMoves = true;
public boolean showNextMoves = true;
Expand Down Expand Up @@ -133,6 +134,7 @@ public Config() throws IOException {
uiConfig = config.getJSONObject("ui");

showMoveNumber = uiConfig.getBoolean("show-move-number");
showStatus = uiConfig.getBoolean("show-status");
showBranch = uiConfig.getBoolean("show-leelaz-variation");
showWinrate = uiConfig.getBoolean("show-winrate");
showVariationGraph = uiConfig.getBoolean("show-variation-graph");
Expand Down Expand Up @@ -248,6 +250,7 @@ private JSONObject createDefaultConfig() {
ui.put("fancy-board", true);
ui.put("shadow-size", 100);
ui.put("show-move-number", false);
ui.put("show-status", true);
ui.put("show-leelaz-variation", true);
ui.put("show-winrate", true);
ui.put("show-variation-graph", true);
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/featurecat/lizzie/gui/LizzieFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public LizzieFrame() {
variationTree = new VariationTree();
winrateGraph = new WinrateGraph();

setMinimumSize( new Dimension(640,480) );
setMinimumSize( new Dimension(640,480) );
setLocationRelativeTo(null); // start centered
JSONArray windowSize = Lizzie.config.uiConfig.getJSONArray("window-size");
setSize(windowSize.getInt(0), windowSize.getInt(1)); // use config file window size
Expand Down Expand Up @@ -373,16 +373,19 @@ public void paint(Graphics g0) {
cachedImage = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) cachedImage.getGraphics();

drawCommandString(g);
if (Lizzie.config.showStatus)
drawCommandString(g);

boardRenderer.setLocation(boardX, boardY);
boardRenderer.setBoardLength(maxSize);
boardRenderer.draw(g);

if (Lizzie.leelaz != null && Lizzie.leelaz.isLoaded()) {
drawPonderingState(g, resourceBundle.getString("LizzieFrame.display.pondering") +
(Lizzie.leelaz.isPondering()?resourceBundle.getString("LizzieFrame.display.on"):resourceBundle.getString("LizzieFrame.display.off")),
ponderingX, ponderingY, ponderingSize);
if (Lizzie.config.showStatus) {
drawPonderingState(g, resourceBundle.getString("LizzieFrame.display.pondering") +
(Lizzie.leelaz.isPondering()?resourceBundle.getString("LizzieFrame.display.on"):resourceBundle.getString("LizzieFrame.display.off")),
ponderingX, ponderingY, ponderingSize);
}

// Todo: Make board move over when there is no space beside the board
if (Lizzie.config.showWinrate) {
Expand All @@ -404,7 +407,7 @@ public void paint(Graphics g0) {
// This can happen when no space is left for subboard.
}
}
} else {
} else if (Lizzie.config.showStatus) {
drawPonderingState(g, resourceBundle.getString("LizzieFrame.display.loading"), loadingX, loadingY, loadingSize);
}

Expand Down