feat: ui remove cell content
All checks were successful
Linux arm64 / Build (push) Successful in 4m7s

This commit is contained in:
2025-01-28 15:18:29 +01:00
parent 944f2c0596
commit 4208e7058f
2 changed files with 15 additions and 6 deletions

View File

@@ -37,16 +37,24 @@ public class SudokuRenderer {
}
private void renderPopup() {
final ImVec2 buttonSize = new ImVec2(50, 50);
if (ImGui.beginPopup("editPopup")) {
Block block = currentCell.getBlock();
int symbolCount = block.getCells().size();
for (int i = 1; i < symbolCount + 1; i++) {
if (i % (int) (Math.sqrt(symbolCount)) != 1)
for (int i = 0; i < symbolCount; i++) {
if ((i + 1) % (int) (Math.sqrt(symbolCount)) != 1)
ImGui.sameLine();
if (ImGui.button(Integer.toString(i), new ImVec2(50, 50))) {
this.doku.setCellValue(currentCell, i - 1);
if (currentCell.getSymbolIndex() == i) {
if (ImGui.button("X", buttonSize)) {
currentCell.setSymbolIndex(Cell.NOSYMBOL);
ImGui.closeCurrentPopup();
}
}else {
if (ImGui.button(Integer.toString(i + 1), buttonSize)) {
this.doku.setCellValue(currentCell, i);
ImGui.closeCurrentPopup();
}
}
}
ImGui.endPopup();
}

View File

@@ -31,7 +31,8 @@ public class SoloMenu extends BaseView {
level += sudoku.getSize() * sudoku.getSize() / 10 * 3;
}
Solver.solve(doku);
SudokuFactory.newDokuFromFilledOne(doku, level - 1);
level = (level - 1) / doku.getNbSubGrids();
SudokuFactory.newDokuFromFilledOne(doku, level);
for (Sudoku sudoku : doku.getSubGrids()) {
for (Cell cell : sudoku.getCells()) {
if (cell.getSymbolIndex() != Cell.NOSYMBOL) {