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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pouchet Pierre
Momomotus
Commits
cf1d8e89
Commit
cf1d8e89
authored
4 months ago
by
Pouchet Pierre
Browse files
Options
Downloads
Patches
Plain Diff
Temps écoulé -> perdu
parent
251cc228
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
-1
12 additions, 1 deletion
Motus/Main.qml
Motus/motusgame.cpp
+19
-3
19 additions, 3 deletions
Motus/motusgame.cpp
Motus/motusgame.h
+15
-0
15 additions, 0 deletions
Motus/motusgame.h
with
46 additions
and
4 deletions
Motus/Main.qml
+
12
−
1
View file @
cf1d8e89
...
@@ -427,7 +427,7 @@ Window {
...
@@ -427,7 +427,7 @@ Window {
border.width
:
3
border.width
:
3
}
}
// Timer
(positionné à droite)
// Timer
MotusTimer
{
MotusTimer
{
id
:
motusTimer
id
:
motusTimer
width
:
100
width
:
100
...
@@ -449,4 +449,15 @@ Window {
...
@@ -449,4 +449,15 @@ Window {
case_focus
=
caseArray
[
0
];
case_focus
=
caseArray
[
0
];
}
}
}
}
Text
{
y
:
32
text
:
"
⛔ Temps écoulé !
"
visible
:
motusGame
.
loosebool
color
:
"
red
"
font.pixelSize
:
30
anchors.horizontalCenterOffset
:
0
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
}
This diff is collapsed.
Click to expand it.
Motus/motusgame.cpp
+
19
−
3
View file @
cf1d8e89
...
@@ -28,6 +28,9 @@ MotusGame::MotusGame(QObject *parent) : QObject(parent) {
...
@@ -28,6 +28,9 @@ MotusGame::MotusGame(QObject *parent) : QObject(parent) {
if
(
remainingTime
==
0
)
{
if
(
remainingTime
==
0
)
{
countdownTimer
->
stop
();
countdownTimer
->
stop
();
qDebug
()
<<
"⏱️ Temps écoulé !"
;
qDebug
()
<<
"⏱️ Temps écoulé !"
;
setLoosebool
(
true
);
// ✅ Appel ici
qDebug
()
<<
"💀 Défaite enregistrée via setLoosebool(true)"
;
}
}
}
}
});
});
...
@@ -124,7 +127,7 @@ void MotusGame::setDictionnaryChoosed(const QString &value) {
...
@@ -124,7 +127,7 @@ void MotusGame::setDictionnaryChoosed(const QString &value) {
void
MotusGame
::
startTimer
()
{
void
MotusGame
::
startTimer
()
{
qDebug
()
<<
"🔁 startTimer() appelé"
;
qDebug
()
<<
"🔁 startTimer() appelé"
;
remainingTime
=
1
2
0
;
remainingTime
=
10
;
emit
timerUpdated
();
emit
timerUpdated
();
countdownTimer
->
stop
();
countdownTimer
->
stop
();
...
@@ -171,12 +174,25 @@ void MotusGame::setRandomizeLetterNumber(bool value) {
...
@@ -171,12 +174,25 @@ void MotusGame::setRandomizeLetterNumber(bool value) {
}
}
// Savoir si ça gagne ou ça perd //////////////////////////////////////////////////////////////////////////////////////////
bool
MotusGame
::
getLoosebool
()
const
{
return
loose
;
}
bool
MotusGame
::
getWinbool
()
const
{
return
loose
;
}
void
MotusGame
::
setLoosebool
(
bool
value
){
loose
=
value
;
emit
looseChanged
();
}
void
MotusGame
::
setWinbool
(
bool
value
){
win
=
value
;
emit
winChanged
();
}
...
...
This diff is collapsed.
Click to expand it.
Motus/motusgame.h
+
15
−
0
View file @
cf1d8e89
...
@@ -22,6 +22,11 @@ class MotusGame : public QObject {
...
@@ -22,6 +22,11 @@ class MotusGame : public QObject {
Q_PROPERTY
(
bool
randomizeLetterNumber
READ
getRandomizeLetterNumber
WRITE
setRandomizeLetterNumber
NOTIFY
randomizeLetterNumberChanged
)
Q_PROPERTY
(
bool
randomizeLetterNumber
READ
getRandomizeLetterNumber
WRITE
setRandomizeLetterNumber
NOTIFY
randomizeLetterNumberChanged
)
Q_PROPERTY
(
bool
loosebool
READ
getLoosebool
WRITE
setLoosebool
NOTIFY
looseChanged
)
Q_PROPERTY
(
bool
winbool
READ
getWinbool
WRITE
setWinbool
NOTIFY
winChanged
)
public:
public:
explicit
MotusGame
(
QObject
*
parent
=
nullptr
);
explicit
MotusGame
(
QObject
*
parent
=
nullptr
);
...
@@ -39,6 +44,11 @@ public:
...
@@ -39,6 +44,11 @@ public:
bool
getRandomizeLetterNumber
()
const
;
bool
getRandomizeLetterNumber
()
const
;
void
setRandomizeLetterNumber
(
bool
value
);
void
setRandomizeLetterNumber
(
bool
value
);
bool
getLoosebool
()
const
;
Q_INVOKABLE
void
setLoosebool
(
bool
value
);
bool
getWinbool
()
const
;
Q_INVOKABLE
void
setWinbool
(
bool
value
);
Q_INVOKABLE
bool
existWord
(
const
QString
&
word
);
Q_INVOKABLE
bool
existWord
(
const
QString
&
word
);
...
@@ -63,6 +73,9 @@ private:
...
@@ -63,6 +73,9 @@ private:
int
remainingTime
=
120
;
// chrono en secondes
int
remainingTime
=
120
;
// chrono en secondes
bool
loose
=
false
;
bool
win
=
false
;
void
loadWords
();
void
loadWords
();
signals:
signals:
...
@@ -70,6 +83,8 @@ signals:
...
@@ -70,6 +83,8 @@ signals:
void
timerUpdated
();
void
timerUpdated
();
void
letterNumberChanged
();
void
letterNumberChanged
();
void
randomizeLetterNumberChanged
();
void
randomizeLetterNumberChanged
();
void
looseChanged
();
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