diff options
| author | Dušan Ďurech <dusan.d@centrum.cz> | 2009-12-27 20:49:44 +0100 |
|---|---|---|
| committer | Dušan Ďurech <dusan.d@centrum.cz> | 2009-12-27 20:49:44 +0100 |
| commit | cdc100ff4a0ceecae2ee2cecaf9df6b82b8636e4 (patch) | |
| tree | c28235253651978153fc97657cf73a2b376197c5 /src/screen | |
| parent | fda7d7a9443a05d7ec0870be482b735a7b4f7ef9 (diff) | |
implements yes/no dialog if to quit the game or not
Diffstat (limited to 'src/screen')
| -rw-r--r-- | src/screen/world.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/screen/world.c b/src/screen/world.c index 1aaa2cc..c2615c8 100644 --- a/src/screen/world.c +++ b/src/screen/world.c @@ -28,6 +28,7 @@ #include "pauza.h" #include "term.h" #include "saveDialog.h" +#include "yes_no_dialog.h" #include "saveLoad.h" #ifndef NO_SOUND @@ -205,6 +206,7 @@ void world_draw() pauza_draw(); term_draw(); save_dialog_draw(); + yes_no_dialog_draw(); } static void netAction(tux_t *tux, int action) @@ -346,7 +348,9 @@ void world_event() net_multiplayer_event(); - if (pauza_is_active() == FALSE && save_dialog_is_active() == FALSE) { + if (pauza_is_active() == FALSE && + save_dialog_is_active() == FALSE && + yes_no_dialog_is_active() == FALSE) { arena_event(arena); /*module_event();*/ } @@ -366,13 +370,28 @@ void world_event() pauza_event(); term_event(); save_dialog_event(); + yes_no_dialog_event(); } -static void hotkey_escape() +void dialog_yes(void *p) { + UNUSED(p); + world_do_end(); } +void dialog_no(void *p) +{ + UNUSED(p); +} + +static void hotkey_escape() +{ + yes_no_dialog_set("Naozaj chete ukoncit hru ?", dialog_yes, dialog_no, NULL); + yes_no_dialog_set_active(TRUE); + //world_do_end(); +} + void startWorld() { arena = NULL; @@ -387,6 +406,8 @@ void startWorld() setGameType(); + yes_no_dialog_init(); + if (net_multiplayer_get_game_type() == NET_GAME_TYPE_NONE) { save_dialog_init(); } @@ -448,6 +469,8 @@ void stoptWorld() pauza_quit(); term_quit(); + yes_no_dialog_quit(); + if (net_multiplayer_get_game_type() == NET_GAME_TYPE_NONE) { save_dialog_quit(); } |