diff --git a/gui.pl b/gui.pl index ce1c3e4..45926df 100644 --- a/gui.pl +++ b/gui.pl @@ -270,6 +270,7 @@ show_controls(D) :- player_tokens(Player, Tokens), string_concat('Aktiv: Spieler ', Player, String_active_player), string_concat('Tokens: ', Tokens, String_tokens), + % die Bausteine zur Steuerung send(Controls, append, new(Label1, label(name, String_active_player))), send(Controls, append, new(Label4, label(name, String_tokens))), @@ -281,7 +282,7 @@ show_controls(D) :- send(Controls, append, new(ToY,text_item('Y:'))), send(Controls, append, button('Bestaetigen',message(@prolog, process_move_unit, FromX, FromY, ToX, ToY, Controls))), send(Controls, append, button('Zug Beenden',message(@prolog, process_end_turn))), - %send(D, left, Controls), + send(Controls, open), assert(game_control(Controls)). @@ -316,6 +317,20 @@ process_end_turn :- update_controls, spielfeld. +game_over_gui(Winner) :- + game_control(C), + game_window(D), + new(G, dialog('Winner')), + new(I, image('win.jpg')), + new(B, bitmap(I)), + send(G, display, B), + atomic_list_concat(['Player ', Winner, ' wins!'], String_result), + send(G, append, new(Label, label(name, String_result))), + send(G, open), + send(C, destroy), + send(D, destroy). + + %TODO delete test_change :- new(D, dialog), diff --git a/logik.pl b/logik.pl index f8d1bb5..9125116 100644 --- a/logik.pl +++ b/logik.pl @@ -183,14 +183,17 @@ game_over(Winner) :- ). + % Falls das Spiel vorbei ist, mach nix end_turn :- game_over(Winner), + game_over_gui(Winner), write("Game Over!"), nl, write("Player "), write(Winner), - write(" wins!"). + write(" wins!"), + reset_game. % Beendet den Aktuellen Zug des Spielers end_turn :- diff --git a/win.jpg b/win.jpg new file mode 100644 index 0000000..a6e00c1 Binary files /dev/null and b/win.jpg differ