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
a5c49941
Commit
a5c49941
authored
2 months ago
by
Pouchet Pierre
Browse files
Options
Downloads
Patches
Plain Diff
Différenciation loose par nombre d'essais ou temps écoulé
parent
67a577a4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Motus/Main.qml
+12
-3
12 additions, 3 deletions
Motus/Main.qml
Motus/motusgame.cpp
+16
-6
16 additions, 6 deletions
Motus/motusgame.cpp
Motus/motusgame.h
+11
-5
11 additions, 5 deletions
Motus/motusgame.h
with
39 additions
and
14 deletions
Motus/Main.qml
+
12
−
3
View file @
a5c49941
...
...
@@ -43,7 +43,7 @@ Window {
// Gestion des touches du clavier physique
Keys.onPressed
:
function
(
event
)
{
if
(
mot
!==
""
&&
!
motusGame
.
loose
&&
!
motusGame
.
win
)
{
if
(
mot
!==
""
&&
!
motusGame
.
loose
try
&&
!
motusGame
.
win
&&
!
motusGame
.
loosetime
)
{
// Saisie d'une lettre (de A à Z)
if
(
/^
[
a-zA-Z
]
$/
.
test
(
event
.
text
))
{
if
(
indice_case
<
nb_lettres
)
{
...
...
@@ -493,8 +493,17 @@ Window {
Text
{
y
:
32
text
:
"
⛔ Temps écoulé !
"
visible
:
motusGame
.
loose
text
:
"
Temps écoulé ! Mot :
"
+
mot
visible
:
motusGame
.
loosetime
color
:
"
red
"
font.pixelSize
:
30
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
Text
{
y
:
32
text
:
"
Nombre d'essais maximum atteint ! Mot :
"
+
mot
visible
:
motusGame
.
loosetry
color
:
"
red
"
font.pixelSize
:
30
anchors.horizontalCenter
:
parent
.
horizontalCenter
...
...
This diff is collapsed.
Click to expand it.
Motus/motusgame.cpp
+
16
−
6
View file @
a5c49941
...
...
@@ -29,7 +29,7 @@ MotusGame::MotusGame(QObject *parent) : QObject(parent) {
countdownTimer
->
stop
();
qDebug
()
<<
"⏱️ Temps écoulé !"
;
setLoosebool
(
true
);
// ✅ Appel ici
setLoose
time
bool
(
true
);
// ✅ Appel ici
qDebug
()
<<
"💀 Défaite enregistrée via setLoosebool(true)"
;
}
}
...
...
@@ -180,18 +180,28 @@ void MotusGame::setRandomizeLetterNumber(bool value) {
// Savoir si ça gagne ou ça perd //////////////////////////////////////////////////////////////////////////////////////////
bool
MotusGame
::
getLoosebool
()
const
{
return
loose
;
bool
MotusGame
::
getLoose
try
bool
()
const
{
return
loose
try
;
}
bool
MotusGame
::
getWinbool
()
const
{
return
win
;
}
void
MotusGame
::
setLoosebool
(
bool
value
){
loose
=
value
;
bool
MotusGame
::
getLoosetimebool
()
const
{
return
loosetime
;
}
void
MotusGame
::
setLoosetimebool
(
bool
value
){
loosetime
=
value
;
this
->
stopTimer
();
emit
loosetimeChanged
();
}
void
MotusGame
::
setLoosetrybool
(
bool
value
){
loosetry
=
value
;
this
->
stopTimer
();
emit
looseChanged
();
emit
loose
try
Changed
();
}
void
MotusGame
::
setWinbool
(
bool
value
){
...
...
This diff is collapsed.
Click to expand it.
Motus/motusgame.h
+
11
−
5
View file @
a5c49941
...
...
@@ -22,7 +22,9 @@ class MotusGame : public QObject {
Q_PROPERTY
(
bool
randomizeLetterNumber
READ
getRandomizeLetterNumber
WRITE
setRandomizeLetterNumber
NOTIFY
randomizeLetterNumberChanged
)
Q_PROPERTY
(
bool
loose
READ
getLoosebool
WRITE
setLoosebool
NOTIFY
looseChanged
)
Q_PROPERTY
(
bool
loosetry
READ
getLoosetrybool
WRITE
setLoosetrybool
NOTIFY
loosetryChanged
)
Q_PROPERTY
(
bool
loosetime
READ
getLoosetimebool
WRITE
setLoosetimebool
NOTIFY
loosetimeChanged
)
Q_PROPERTY
(
bool
win
READ
getWinbool
WRITE
setWinbool
NOTIFY
winChanged
)
...
...
@@ -45,8 +47,10 @@ public:
bool
getRandomizeLetterNumber
()
const
;
void
setRandomizeLetterNumber
(
bool
value
);
bool
getLoosebool
()
const
;
Q_INVOKABLE
void
setLoosebool
(
bool
value
);
bool
getLoosetrybool
()
const
;
Q_INVOKABLE
void
setLoosetrybool
(
bool
value
);
bool
getLoosetimebool
()
const
;
Q_INVOKABLE
void
setLoosetimebool
(
bool
value
);
bool
getWinbool
()
const
;
Q_INVOKABLE
void
setWinbool
(
bool
value
);
...
...
@@ -76,7 +80,8 @@ private:
int
remainingTime
=
120
;
// chrono en secondes
bool
loose
=
false
;
bool
loosetry
=
false
;
bool
loosetime
=
false
;
bool
win
=
false
;
void
loadWords
();
...
...
@@ -86,7 +91,8 @@ signals:
void
timerUpdated
();
void
letterNumberChanged
();
void
randomizeLetterNumberChanged
();
void
looseChanged
();
void
loosetryChanged
();
void
loosetimeChanged
();
void
winChanged
();
...
...
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