feat: change symbols
All checks were successful
Linux arm64 / Build (push) Successful in 27s

This commit is contained in:
2025-01-30 15:23:54 +01:00
parent 9b776d4b0f
commit 7789209651
3 changed files with 30 additions and 6 deletions

View File

@@ -75,7 +75,7 @@ public class SudokuRenderer {
ImGui.closeCurrentPopup(); ImGui.closeCurrentPopup();
} }
} else { } else {
if (ImGui.button(Integer.toString(i + 1), cellSize)) { if (ImGui.button(Options.Symboles.getSymbols().get(i), cellSize)) {
this.doku.setCellValue(currentCell, i); this.doku.setCellValue(currentCell, i);
if (this.doku.isResolved()) if (this.doku.isResolved())
this.onResolve.emit(); this.onResolve.emit();
@@ -123,7 +123,7 @@ public class SudokuRenderer {
ImGui.pushStyleColor(ImGuiCol.Button, new ImVec4(blockColor.r, blockColor.g, blockColor.b, 1.0f)); ImGui.pushStyleColor(ImGuiCol.Button, new ImVec4(blockColor.r, blockColor.g, blockColor.b, 1.0f));
String cellText = ""; String cellText = "";
if (symbol != -1) if (symbol != -1)
cellText += Integer.toString(symbol + 1); cellText += Options.Symboles.getSymbols().get(cell.getSymbolIndex());
if (ImGui.button(cellText + "##" + index, cellSize) && cell.isMutable()) { if (ImGui.button(cellText + "##" + index, cellSize) && cell.isMutable()) {
ImGui.openPopup("editPopup"); ImGui.openPopup("editPopup");
currentCell = cell; currentCell = cell;

View File

@@ -5,8 +5,8 @@ import java.util.List;
public enum Symbols { public enum Symbols {
Numbers("Nombres", getNumbers()), Numbers("Nombres", getNumbers()),
Letters("Lettres", getLetters()), Letters("Lettres", getLetters()),
Emojis("Emojis", getEmojis()); Emojis("Emojis", getEmojis());
String displayName; String displayName;
@@ -17,6 +17,10 @@ public enum Symbols {
this.displayName = displayName; this.displayName = displayName;
} }
public String getDisplayName() {
return displayName;
}
public List<String> getSymbols() { public List<String> getSymbols() {
return symbols; return symbols;
} }
@@ -50,8 +54,21 @@ public enum Symbols {
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
sym.add(new String(Character.toChars(0X1F600 + i))); sym.add(new String(Character.toChars(0X1F600 + i)));
} }
System.out.println(sym);
return sym; return sym;
} }
private static final String[] symbolNames;
static {
Symbols[] symbols = Symbols.values();
symbolNames = new String[symbols.length];
for (int i = 0; i < symbols.length; i++) {
symbolNames[i] = symbols[i].getDisplayName();
}
}
public static String[] getSymbolsNames() {
return symbolNames;
}
} }

View File

@@ -1,17 +1,24 @@
package gui.menu; package gui.menu;
import gui.Options;
import gui.Symbols;
import imgui.ImGui; import imgui.ImGui;
import imgui.type.ImInt;
public class OptionsMenu extends BaseView { public class OptionsMenu extends BaseView {
private ImInt currentValue = new ImInt();
public OptionsMenu(StateMachine stateMachine) { public OptionsMenu(StateMachine stateMachine) {
super(stateMachine); super(stateMachine);
} }
@Override @Override
public void render() { public void render() {
// TODO Auto-generated method stub
ImGui.text("Options"); ImGui.text("Options");
if(ImGui.combo("Jeu de symboles", currentValue, Symbols.getSymbolsNames())){
Options.Symboles = Symbols.values()[currentValue.get()];
}
renderReturnButton(); renderReturnButton();
} }