diff --git a/Motus/CMakeLists.txt b/Motus/CMakeLists.txt index 3a1b4da3e1a11c423e914ccd08d9aab713bad917..6ca28d7ef294acd343fe987956a6e0c56dc0d975 100644 --- a/Motus/CMakeLists.txt +++ b/Motus/CMakeLists.txt @@ -48,6 +48,7 @@ qt_add_qml_module(appMotus QML_FILES MotusTimer.qml QML_FILES NumberLetterButton.qml RESOURCES qtquickcontrols2.conf + RESOURCES mots_francais_bis.txt ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. diff --git a/Motus/Case.qml b/Motus/Case.qml index 71ddcbac1a2f9f3c26f42857c71262625dd6a531..6ca6f640ad51667b5f78899ab08d18a3aea1099e 100644 --- a/Motus/Case.qml +++ b/Motus/Case.qml @@ -4,6 +4,8 @@ Item { id: _item width: 70 height: 70 + property alias rectangleBordercolor: rectangle.border.color + property alias rectangleColor: rectangle.color focus: false property alias rectangleBorderwidth: rectangle.border.width property alias _textText: _text.text @@ -26,11 +28,11 @@ Item { color: "#ffffff" text: qsTr("") anchors.verticalCenter: parent.verticalCenter - font.pixelSize: 60 + font.pixelSize: 50 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.family: "Tahoma" - font.styleName: "Bold" + font.styleName: "Regular" anchors.horizontalCenter: parent.horizontalCenter } } diff --git a/Motus/Main.qml b/Motus/Main.qml index 5642af2769d49d4aefa68c3e57d65340be9ffa6b..f668b7c4c3141347ea8d78115f2380bba034c1da 100644 --- a/Motus/Main.qml +++ b/Motus/Main.qml @@ -56,15 +56,31 @@ Window { // Passage à la ligne suivante avec la touche Entrée else if (event.key === Qt.Key_Return) { // On ne passe à la ligne suivante que si la ligne est complètement remplie + console.log(indice_case); if (indice_case === nb_lettres) { - // Ici, vous pouvez ajouter la vérification de la proposition (vérifier les lettres, colorier, etc.) + // Vérification de la proposition sur la ligne actuelle + for (var ind_verif = 0; ind_verif < nb_lettres; ind_verif++) { + var case_verif = caseArray[current_essai * nb_lettres + ind_verif]; + var lettre_verif = case_verif._textText; + if (lettre_verif === mot_split[ind_verif].toUpperCase()) { + case_verif.rectangleColor = "#42cc3d"; + case_verif.rectangleBordercolor = "#42cc3d"; + } else { + for (var j = 0; j < nb_lettres; j++) { + if (lettre_verif === mot_split[j].toUpperCase()) { + case_verif.rectangleColor = "#f0d437"; + case_verif.rectangleBordercolor = "#f0d437"; + break; + } + } + } + } + // Après vérification, passage à la ligne suivante si possible if (current_essai < nb_essais - 1) { current_essai++; indice_case = 0; - } - else { - // Fin de partie : désactiver l'interface ou lancer une animation de fin, etc. - // Par exemple, réinitialiser nb_essais ou afficher un message + } else { + // Fin de partie : vous pouvez désactiver l'interface ou afficher un message mot = ""; } event.accepted = true;