add restart button to game over screen
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QResizeEvent>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@@ -106,7 +107,17 @@ void MainWindow::onGameOver()
|
||||
box.setText(QString("HQ destroyed!\nSurvival time: %1:%2")
|
||||
.arg(minutes, 2, 10, QChar('0'))
|
||||
.arg(seconds, 2, 10, QChar('0')));
|
||||
QPushButton* restartBtn = box.addButton("Restart", QMessageBox::AcceptRole);
|
||||
box.addButton("Quit", QMessageBox::RejectRole);
|
||||
box.exec();
|
||||
close();
|
||||
|
||||
if (box.clickedButton() == restartBtn)
|
||||
{
|
||||
m_sim->reset();
|
||||
m_gameWorldView->resetForNewGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user