Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Momomotus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pouchet Pierre
Momomotus
Commits
96f3ab1c
Commit
96f3ab1c
authored
2 months ago
by
Pouchet Pierre
Browse files
Options
Downloads
Patches
Plain Diff
Correction : on peut jouer !
parent
2150558c
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Motus/Case.qml
+7
-1
7 additions, 1 deletion
Motus/Case.qml
Motus/Main.qml
+25
-4
25 additions, 4 deletions
Motus/Main.qml
Motus/motusgame.cpp
+2
-2
2 additions, 2 deletions
Motus/motusgame.cpp
Motus/motusgame.h
+1
-0
1 addition, 0 deletions
Motus/motusgame.h
with
35 additions
and
7 deletions
Motus/Case.qml
+
7
−
1
View file @
96f3ab1c
...
...
@@ -6,10 +6,16 @@ Item {
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
focus
:
false
function
resetFocus
()
{
focus
=
true
}
Rectangle
{
id
:
rectangle
width
:
70
...
...
This diff is collapsed.
Click to expand it.
Motus/Main.qml
+
25
−
4
View file @
96f3ab1c
...
...
@@ -134,7 +134,10 @@ Window {
case_focus
=
caseArray
[
current_essai
*
nb_lettres
];
}
else
{
// Fin de partie : désactiver l'interface ou afficher un message
mot
=
""
;
if
(
mot_rentre
!=
mot
){
motusGame
.
loosetry
=
true
;}
}
}
else
{
// Le mot n'existe pas dans le dictionnaire : colorer toute la ligne en rouge
...
...
@@ -200,9 +203,25 @@ Window {
MouseArea
{
anchors.fill
:
parent
cursorShape
:
Qt
.
PointingHandCursor
enabled
:
motusGame
.
win
||
motusGame
.
loosetry
||
motusGame
.
loosetime
||
!
motusGame
.
debut
enabled
:
motusGame
&&
(
motusGame
.
win
||
motusGame
.
loosetry
||
motusGame
.
loosetime
||
!
motusGame
.
debut
)
onClicked
:
{
// 1. Réinitialiser les indices AVANT de tout
current_essai
=
0
;
indice_case
=
0
;
// 2. Vider toutes les cases
for
(
var
i
=
0
;
i
<
caseArray
.
length
;
i
++
)
{
caseArray
[
i
].
_textText
=
""
;
caseArray
[
i
].
rectangleColor
=
"
#323232
"
;
caseArray
[
i
].
rectangleBorderColor
=
"
#ffffff
"
;
}
// 3. Vider les touches clavier
for
(
var
j
=
0
;
j
<
keysArray
.
length
;
j
++
)
{
keysArray
[
j
].
keyColor
=
"
#808080
"
;
}
// Début d'une partie, désactivation des boutons de régénération, etc.
motusGame
.
debut
=
true
;
mot
=
motusGame
.
getRandomWord
(
nb_lettres
);
...
...
@@ -213,6 +232,8 @@ Window {
case3
.
_textText
=
mot
;
mot_split
=
mot
.
split
(
""
);
console
.
log
(
mot_split
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Motus/motusgame.cpp
+
2
−
2
View file @
96f3ab1c
...
...
@@ -95,7 +95,7 @@ bool MotusGame::existWord(const QString &word) {
QString
MotusGame
::
getRandomWord
(
int
letterCount
)
{
// Vérifier que le nombre de lettres est dans l'intervalle autorisé
if
(
letterCount
<
4
||
letterCount
>
12
)
{
if
(
letterCount
<
5
||
letterCount
>
12
)
{
qDebug
()
<<
"❌ Nombre de lettres invalide. Choisissez un nombre entre 4 et 12."
;
return
""
;
}
...
...
@@ -131,7 +131,7 @@ void MotusGame::setDictionnaryChoosed(const QString &value) {
void
MotusGame
::
startTimer
()
{
qDebug
()
<<
"🔁 startTimer() appelé"
;
remainingTime
=
5
;
remainingTime
=
duree_timer
;
emit
timerUpdated
();
countdownTimer
->
stop
();
...
...
This diff is collapsed.
Click to expand it.
Motus/motusgame.h
+
1
−
0
View file @
96f3ab1c
...
...
@@ -84,6 +84,7 @@ private:
bool
loosetime
=
false
;
bool
win
=
false
;
bool
debut
=
false
;
int
duree_timer
=
120
;
void
loadWords
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment