Fixes #23
All checks were successful
Linux arm64 / Build (push) Successful in 37s

This commit is contained in:
2025-02-01 20:55:08 +01:00
parent 436b641269
commit f0a0a8e328
3 changed files with 12 additions and 7 deletions

View File

@@ -20,7 +20,8 @@ public class MultiMenu extends BaseView {
private void renderCreate() {
ImVec2 displaySize = ImGui.getIO().getDisplaySize();
ImGui.beginChild("##CreateGame", new ImVec2(displaySize.x / 2.0f, displaySize.y * 8.0f / 9.0f));
ImGui.inputInt("Port", port);
if (ImGui.inputInt("Port", port))
port.set(Math.clamp(port.get(), 1, 65535));
if (ImGui.button("Créer")) {
try {
this.stateMachine.pushState(new ConnexionStatusView(stateMachine, (short) port.get()));
@@ -35,12 +36,12 @@ public class MultiMenu extends BaseView {
ImVec2 displaySize = ImGui.getIO().getDisplaySize();
ImGui.beginChild("##JoinGame", new ImVec2(displaySize.x / 2.0f, displaySize.y * 8.0f / 9.0f));
ImGui.inputText("Adresse", address);
ImGui.inputInt("Port", port);
if (ImGui.inputInt("Port", port))
port.set(Math.clamp(port.get(), 1, 65535));
if (ImGui.button("Rejoindre")) {
try {
this.stateMachine.pushState(new ConnexionStatusView(stateMachine, address.get(), (short) port.get()));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

View File

@@ -68,7 +68,8 @@ public class MultiPlayerView extends BaseView {
}
private void renderTimer() {
ImGui.inputInt("Temps de la partie (minutes)", gameDurationMinutes);
if (ImGui.inputInt("Temps de la partie (minutes)", gameDurationMinutes))
gameDurationMinutes.set(Math.clamp(gameDurationMinutes.get(), 1, 90));
}
@Override

View File

@@ -98,7 +98,8 @@ public class SudokuSelector {
SudokuType currentType = SudokuType.values()[sudokuType.get()];
switch (currentType.getMakerParamCount()) {
case 1:
ImGui.inputInt("Taille", sudokuSize);
if (ImGui.inputInt("Taille", sudokuSize))
sudokuSize.set(Math.clamp(sudokuSize.get(), 1, 10));
if (ImGui.button(confirmMessage)) {
selectSudoku(currentType.createDoku(getConstraints(), sudokuSize.get()), false);
}
@@ -108,8 +109,10 @@ public class SudokuSelector {
break;
case 2:
ImGui.inputInt("Largeur", sudokuHeight);
ImGui.inputInt("Longueur", sudokuWidth);
if (ImGui.inputInt("Longueur", sudokuWidth))
sudokuWidth.set(Math.clamp(sudokuWidth.get(), 1, 10));
if (ImGui.inputInt("Hauteur", sudokuHeight))
sudokuHeight.set(Math.clamp(sudokuHeight.get(), 1, 10));
if (ImGui.button(confirmMessage)) {
selectSudoku(currentType.createDoku(getConstraints(), sudokuWidth.get(), sudokuHeight.get()),
false);