Merge branch 'main'

This commit is contained in:
Maximilian Wagner 2023-06-23 17:03:30 +02:00
commit 01d0b1acfc
3 changed files with 20 additions and 2 deletions

17
gui.pl
View File

@ -270,6 +270,7 @@ show_controls(D) :-
player_tokens(Player, Tokens), player_tokens(Player, Tokens),
string_concat('Aktiv: Spieler ', Player, String_active_player), string_concat('Aktiv: Spieler ', Player, String_active_player),
string_concat('Tokens: ', Tokens, String_tokens), string_concat('Tokens: ', Tokens, String_tokens),
% die Bausteine zur Steuerung % die Bausteine zur Steuerung
send(Controls, append, new(Label1, label(name, String_active_player))), send(Controls, append, new(Label1, label(name, String_active_player))),
send(Controls, append, new(Label4, label(name, String_tokens))), 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, new(ToY,text_item('Y:'))),
send(Controls, append, button('Bestaetigen',message(@prolog, process_move_unit, FromX, FromY, ToX, ToY, Controls))), 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(Controls, append, button('Zug Beenden',message(@prolog, process_end_turn))),
%send(D, left, Controls),
send(Controls, open), send(Controls, open),
assert(game_control(Controls)). assert(game_control(Controls)).
@ -316,6 +317,20 @@ process_end_turn :-
update_controls, update_controls,
spielfeld. 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 %TODO delete
test_change :- test_change :-
new(D, dialog), new(D, dialog),

View File

@ -183,14 +183,17 @@ game_over(Winner) :-
). ).
% Falls das Spiel vorbei ist, mach nix % Falls das Spiel vorbei ist, mach nix
end_turn :- end_turn :-
game_over(Winner), game_over(Winner),
game_over_gui(Winner),
write("Game Over!"), nl, write("Game Over!"), nl,
write("Player "), write("Player "),
write(Winner), write(Winner),
write(" wins!"). write(" wins!"),
reset_game.
% Beendet den Aktuellen Zug des Spielers % Beendet den Aktuellen Zug des Spielers
end_turn :- end_turn :-

BIN
win.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB