Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Application 2048
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
Delplanque Sara
Application 2048
Commits
a9cb3ad3
Commit
a9cb3ad3
authored
2 months ago
by
Delplanque Sara
Browse files
Options
Downloads
Patches
Plain Diff
essai affichage meilleur score : pas encore abouti
parent
67571449
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
applicationQT2048/GamePage.qml
+1
-1
1 addition, 1 deletion
applicationQT2048/GamePage.qml
applicationQT2048/gamemanager.cpp
+12
-10
12 additions, 10 deletions
applicationQT2048/gamemanager.cpp
with
13 additions
and
11 deletions
applicationQT2048/GamePage.qml
+
1
−
1
View file @
a9cb3ad3
...
...
@@ -88,7 +88,7 @@ FocusScope { // Permet de capter le focus pour les raccourcis clavier
Text
{
id
:
bestScore
text
:
"
0
"
text
:
gameManager
.
bestScore
color
:
"
white
"
font.bold
:
true
font.pixelSize
:
25
...
...
This diff is collapsed.
Click to expand it.
applicationQT2048/gamemanager.cpp
+
12
−
10
View file @
a9cb3ad3
...
...
@@ -206,15 +206,12 @@ void GameManager::restartGame(QString partieName) {
//demander pour sauvergarder la partie précédente
<<<<<<<
HEAD
if
(
partieName
==
"false"
){
}
else
{
enregistrerPartie
(
partieName
);
};
=======
enregistrerPartie
(
"partie1"
);
m_gameOver
=
false
;
>>>>>>>
e22daca7a3c09bd0a515d12093b0cbf7e3e4e152
// Réinitialisation des variables
...
...
@@ -449,10 +446,10 @@ int GameManager::score() const {
return
m_score
;
// Retourne le score actuel
}
<<<<<<<
HEAD
=======
void
GameManager
::
calculscore
(){
if
(
m_gameOver
)
{
// Si la partie est terminée, ne calcule pas le score
return
;
...
...
@@ -466,6 +463,9 @@ void GameManager::calculscore(){
}
}
emit
scoreChanged
();
if
(
isGameOver
())
{
endGame
();
// Appeler endGame pour mettre à jour le meilleur score si nécessaire
}
}
bool
GameManager
::
isGameOver
()
{
...
...
@@ -484,15 +484,17 @@ bool GameManager::isGameOver() {
return
true
;
// Si la grille est pleine et aucune fusion n'est possible, la partie est terminée
endGame
();
}
<<<<<<<
Updated
upstream
>>>>>>>
e22daca7a3c09bd0a515d12093b0cbf7e3e4e152
=======
void
GameManager
::
endGame
()
{
// Comparer le score actuel avec le meilleur score
if
(
m_score
>
m_bestScore
)
{
m_bestScore
=
m_score
;
// Mettre à jour le meilleur score
enregistrerMeilleurScore
();
// Enregistrer le meilleur score
emit
bestScoreChanged
();
}
}
int
GameManager
::
bestScore
()
const
{
return
m_bestScore
;
// Retourne le meilleur score
}
>>>>>>>
Stashed
changes
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