Bug#760413: Bug#760379: tuxpuck: window close button does not work

Markus Koschany apo at gambaru.de
Wed Sep 10 14:05:48 UTC 2014


On Wed, 03 Sep 2014 22:04:14 +0200 Markus Koschany <apo at gambaru.de> wrote:
[...]

>I'm not sure what's causing
> this hence I'm going to clone the bug report into another one.

After more investigation I have found out that there is no consistent
way in TuxPuck to handle SDL_QUIT events.

If one adds the following code to menu.c, it becomes possible to close
the window when the main menu is activated. But the exit_, again_ and
op_menu need to be addressed differently. It would be better if there
was a single big main loop which caught all events in one place.

Not being able to close the game window by pressing the X button does
not worry me much at the moment. It seems this is also somehow intended
and closing the game works fine if you just use the in-game menu.


---
 menu.c    |  4 ++++
 tuxpuck.c | 35 ++++++++++++++++++++++++++---------
 2 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/menu.c b/menu.c
index 4b8f556..d1590cf 100644
--- a/menu.c
+++ b/menu.c
@@ -177,6 +177,10 @@ int menu_get_selected(Menu * menu)
 >--  break;
 >--}
 >--break;
+      case SDL_QUIT:
+      menu->selected = -1;
+      loop = 0;
+      break;
       }
     }
     SDL_Delay(SLEEP);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20140910/18117a15/attachment.sig>


More information about the Pkg-games-devel mailing list