forked from kenegozi/kalah-prolog
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dialogs.pl
62 lines (54 loc) · 3.37 KB
/
dialogs.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/***********************************************************************
Program : Kalah game in PROLOG
Written by : Ken Egozi
File : dialogs.pl
Description : dialog windows declerations - to be used with
the Dialog Editor
***********************************************************************/
/*The entry window for the game*/
dlg_main_window :-
_S1 = [ws_caption,ws_sysmenu,dlg_ownedbyprolog],
_S2 = [ws_child,ws_visible,ss_center],
_S3 = [ws_child,ws_tabstop,ws_visible,bs_pushbutton,bs_text,bs_center,bs_vcenter],
wdcreate( dlg_main_window, `Kalah`, 160, 45, 356, 176, _S1 ),
wccreate( (dlg_main_window,11000), static, `Kalah Game`, 30, 40, 290, 40, _S2 ),
wccreate( (dlg_main_window,1000), button, `New Game`, 30, 90, 130, 30, _S3 ),
wccreate( (dlg_main_window,1001), button, `Exit`, 190, 90, 130, 30, _S3 ).
/*Options dialog - when starting a new game*/
dlg_options :-
_S1 = [ws_caption,dlg_ownedbyprolog,ws_ex_topmost,ws_ex_dlgmodalframe],
_S3 = [ws_child,ws_visible,ws_ex_right,ss_left],
_S4 = [ws_child,ws_tabstop,ws_visible,cbs_dropdownlist,cbs_autohscroll,cbs_disablenoscroll,ws_vscroll],
_S5 = [ws_child,ws_visible,ws_tabstop,cbs_dropdownlist,cbs_autohscroll,cbs_disablenoscroll,ws_vscroll],
_S6 = [ws_child,ws_tabstop,ws_visible,bs_pushbutton,bs_text,bs_center,bs_vcenter],
wdcreate( dlg_options, `Options`, 160, 45, 366, 256, _S1 ),
wccreate( (dlg_options,11001), static, `Board size:`, 60, 40, 80, 20, _S3 ),
wccreate( (dlg_options,11002), static, `Level:`, 60, 80, 80, 20, _S3 ),
wccreate( (dlg_options,11003), static, `First:`, 60, 120, 80, 20, _S3 ),
wccreate( (dlg_options,5000), combobox, `BoardSize`, 150, 40, 40, 80, _S4 ),
wccreate( (dlg_options,5001), combobox, `Level`, 150, 80, 100, 80, _S5 ),
wccreate( (dlg_options,5002), combobox, `First`, 150, 120, 100, 80, _S5 ),
wccreate( (dlg_options,1000), button, `Start game`, 60, 160, 130, 30, _S6 ),
wccreate( (dlg_options,1001), button, `Cancel`, 60, 190, 130, 30, _S6 ).
on_show(dlg_options):-
set_combo_values((dlg_options,5000), 6, [4,5,6,7,8]),
set_combo_values((dlg_options,5001), `Regular`, [`Easy`,`Regular`,`Expert`]),
set_combo_values((dlg_options,5002), `Human`, [`Human`,`Computer`]).
/*Actual gameboard window*/
dlg_game_board :-
_S1 = [ws_sysmenu,ws_popup,ws_caption,dlg_ownedbyprolog],
_S2 = [ws_child,ws_border,ws_visible],
_S3 = [ws_child,ws_visible,bs_pushbutton,bs_text,bs_center,bs_vcenter],
_S4 = [ws_child,ws_visible],
pits(Size),
board_size(Size, BoardWidth, BoardHeight),
WindowHeight is BoardHeight + 130,
WindowWidth is BoardWidth + 40,
RestartGameX is WindowWidth - 20 - 70,
MessageY is 40 + BoardHeight + 5,
wdcreate( dlg_game_board, `Kalah`, 160, 45, WindowWidth , WindowHeight , _S1 ),
wccreate( (dlg_game_board,10000), grafix, `Board`, 20, 40, BoardWidth, BoardHeight, _S2 ),
wccreate( (dlg_game_board,10001), button, `Start over`, RestartGameX , 10, 70 , 20, _S3 ),
wccreate( (dlg_game_board,10002), button, `End game`, 20, 10, 70 , 20, _S3 ),
wccreate( (dlg_game_board,10003), grafix, `Messages`, 20, MessageY, BoardWidth, 50, _S4 ).
game_board( (dlg_game_board,10000) ).