Attached is a patch.
I shall make a new upstream release later.
Would you mind testing it?
--
Sylvain
diff --git a/src/game.cpp b/src/game.cpp
index e3363df..f7ede49 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -398,6 +398,11 @@ void Game::run()
destroy_bitmap(buffer);
}
+void Game::quit()
+{
+ state = EXIT;
+}
+
void Game::drawSplashScreen(BITMAP* dest)
{
BITMAP* darkbitsLogo = ResourceHandler::getInstance()->getBitmap("darkbitslogo_by_haiko.bmp");
diff --git a/src/game.hpp b/src/game.hpp
index c586186..af5d928 100644
--- a/src/game.hpp
+++ b/src/game.hpp
@@ -51,6 +51,8 @@ public:
void run();
+ void quit();
+
void action(const gcn::ActionEvent& actionEvent);
void keyPressed(gcn::KeyEvent &keyEvent);
diff --git a/src/main.cpp b/src/main.cpp
index deaf132..7deda18 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -36,11 +36,21 @@
#include "game.hpp"
#include "guichan.hpp"
+Game* cur_game = NULL;
+void close_button_handler(void)
+{
+ cur_game->quit();
+}
+END_OF_FUNCTION(close_button_handler)
+
int main(int argc, char **argv)
{
try
{
Game game;
+ LOCK_FUNCTION(close_button_handler);
+ set_close_button_callback(close_button_handler);
+ cur_game = &game;
game.run();
}
catch (gcn::Exception e)