summaryrefslogtreecommitdiff
path: root/MainWindow.cpp
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-12 15:18:11 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-12 15:18:11 +0930
commit26dd84dae8fab02aa50ad1a5d28e668a95d49afc (patch)
tree0c6ee256ad12d1069b066dcc7b1a4ead9947596b /MainWindow.cpp
parent037f27434849506d92f844354f491ddf967d5c51 (diff)
downloadfoxminesweeper-26dd84dae8fab02aa50ad1a5d28e668a95d49afc.tar.gz
foxminesweeper-26dd84dae8fab02aa50ad1a5d28e668a95d49afc.zip
make loss/win message boxes modal and blocking
Diffstat (limited to 'MainWindow.cpp')
-rw-r--r--MainWindow.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/MainWindow.cpp b/MainWindow.cpp
index 61cbac9..ca632b6 100644
--- a/MainWindow.cpp
+++ b/MainWindow.cpp
@@ -14,6 +14,7 @@
*/
#include "MainWindow.h"
+#include "FXMessageBox.h"
#include "fxdefs.h"
#include <cstdlib> // rand
#include <memory>
@@ -235,24 +236,20 @@ MainWindow::on_Tile_Click(FXObject *sender, FXSelector sel, void *data)
if (!board->is_game_running() && !board->is_game_won())
{
/* lost */
+ draw_buttons();
app->removeTimeout(this, UI_Timer_Tick);
puts("you lose the game");
- std::string message = "You lost in: " + std::to_string(seconds) + " seconds";
- FXMessageBox *msgbox = new FXMessageBox(app, "Game Over", FXString(message.c_str()), nullptr, FX::MBOX_OK);
- msgbox->create();
- msgbox->show();
+ FXMessageBox::information(app, FX::MBOX_OK, "Game Over", "You lost in %ld seconds.", seconds);
game_over = true;
ticking = false;
}
else if (!board->is_game_running() && board->is_game_won())
{
/* won */
+ draw_buttons();
app->removeTimeout(this, UI_Timer_Tick);
puts("you won the game");
- std::string message = "You won in: " + std::to_string(seconds) + " seconds";
- FXMessageBox *msgbox = new FXMessageBox(app, "Game Over", FXString(message.c_str()), nullptr, FX::MBOX_OK);
- msgbox->create();
- msgbox->show();
+ FXMessageBox::information(app, FX::MBOX_OK, "Game Over", "You lost in %ld seconds.", seconds);
game_over = true;
ticking = false;
}