Skip to content

Commit

Permalink
return home
Browse files Browse the repository at this point in the history
  • Loading branch information
Augustin-maker committed Apr 15, 2024
1 parent 9f839cf commit 0b14582
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/screens/endgamescreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,20 @@ EndGameScreen::EndGameScreen(const int score, QWidget *parent)

connect(submitButton, &QPushButton::clicked, this, &EndGameScreen::submitName);

// Création du bouton de retour au menu principal
QPushButton *returnButton = new QPushButton("Return to Main Menu", this);
returnButton->setFont(QFont("Arial", 16));
returnButton->setFixedSize(200, 50); // Taille fixe pour le bouton
connect(returnButton, &QPushButton::clicked, this, &EndGameScreen::returnToMainMenu);




// Ajouter les widgets au layout
layout->addWidget(nameInput);
layout->addWidget(submitButton);
// Ajout du bouton au layout
layout->addWidget(returnButton);

// Déf layout pour la fenêtre
setLayout(layout);
Expand All @@ -99,4 +110,10 @@ void EndGameScreen::submitName() {
out << playerName << endl;

file.close();
}


void EndGameScreen::returnToMainMenu() {
// Mettez ici le code pour revenir au menu principal, par exemple :
emit returnToMainMenuClicked(); // Émet un signal pour informer le parent que le bouton a été cliqué
}
4 changes: 4 additions & 0 deletions src/screens/endgamescreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ Q_OBJECT

private slots:
void submitName();
void returnToMainMenu();

private:
QLabel *scoreLabel;
QLineEdit *nameInput;

signals:
void returnToMainMenuClicked();
};

#endif //SNAKEQT_ENDGAMESCREEN_HPP

0 comments on commit 0b14582

Please sign in to comment.