Compare commits
2 Commits
73f572ee18
...
1f92c49f3c
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f92c49f3c | |||
| c262007ca8 |
@@ -126,7 +126,7 @@ public class SudokuRenderer {
|
||||
ImGui.pushStyleColor(ImGuiCol.Button, new ImVec4(blockColor.r, blockColor.g, blockColor.b, 1.0f));
|
||||
String cellText = "";
|
||||
if (symbol != -1)
|
||||
cellText += Options.Symboles.getSymbols().get(cell.getSymbolIndex());
|
||||
cellText += Options.Symboles.getSymbols().get(symbol);
|
||||
if (ImGui.button(cellText + "##" + index, cellSize) && cell.isMutable()) {
|
||||
ImGui.openPopup("editPopup");
|
||||
currentCell = cell;
|
||||
|
||||
@@ -66,34 +66,64 @@ public class SudokuView extends BaseView {
|
||||
stopResolve();
|
||||
}
|
||||
|
||||
private void renderSolveButton() {
|
||||
if (resolveThread != null)
|
||||
ImGui.beginDisabled();
|
||||
|
||||
boolean beginSolve = false;
|
||||
|
||||
if (!resolved && centeredButton("Résoudre")) {
|
||||
beginSolve = true;
|
||||
}
|
||||
if (resolveThread != null)
|
||||
ImGui.endDisabled();
|
||||
|
||||
if (beginSolve) {
|
||||
private void renderSolvePopup() {
|
||||
if (ImGui.beginPopup("solve")) {
|
||||
if (ImGui.button("Résoudre avec backtrace")) {
|
||||
resolveThread = new Thread(() -> {
|
||||
try {
|
||||
Random rand = new Random();
|
||||
Solver.randomSolve(doku, rand);
|
||||
Thread.sleep(200);
|
||||
} catch (CancellationException | InterruptedException e) {
|
||||
} catch (CancellationException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
});
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
if (ImGui.button("Résoudre avec déduction")) {
|
||||
resolveThread = new Thread(() -> {
|
||||
try {
|
||||
Solver.humanSolve(doku);
|
||||
} catch (CancellationException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
});
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
if (ImGui.button("Résoudre avec déduction et backtrace")) {
|
||||
resolveThread = new Thread(() -> {
|
||||
try {
|
||||
Random rand = new Random();
|
||||
Solver.mixedSolve(doku, rand);
|
||||
} catch (CancellationException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
});
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
ImGui.endPopup();
|
||||
}
|
||||
}
|
||||
|
||||
if (resolved) {
|
||||
private void renderSolveButton() {
|
||||
if (resolveThread != null)
|
||||
ImGui.beginDisabled();
|
||||
|
||||
if (!this.resolved && centeredButton("Résoudre")) {
|
||||
// beginSolve = true;
|
||||
ImGui.openPopup("solve");
|
||||
}
|
||||
|
||||
if (resolveThread != null)
|
||||
ImGui.endDisabled();
|
||||
|
||||
if (this.resolved) {
|
||||
ImGui.text("Bravo !");
|
||||
}
|
||||
|
||||
renderSolvePopup();
|
||||
}
|
||||
|
||||
private void renderSaveButton() {
|
||||
|
||||
Reference in New Issue
Block a user