Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* ocamlopt.opt -o squava -w s -I +lablgtk2 lablgtk.cmxa squava.ml *)
- (* ./squava *)
- let window =
- GMain.init ();
- let wnd = GWindow.window ~resizable:true ~title:"Squava board game" ()
- in wnd#connect#destroy GMain.quit; wnd
- let vbox1 =
- GPack.vbox ~packing:window#add ()
- let button id tooltip =
- let but = GButton.tool_button ~stock:id () in
- but#misc#set_tooltip_text tooltip;
- but
- let start =
- button `NEW "Start a new game"
- let about =
- button `ABOUT "About Squava"
- let toolbar =
- let bar = GButton.toolbar
- ~orientation:`HORIZONTAL ~style:`ICONS ~packing:vbox1#pack ()
- in
- bar#set_icon_size `LARGE_TOOLBAR;
- bar#insert start;
- bar#insert (GButton.separator_tool_item ());
- bar#insert about;
- bar
- let center =
- GBin.alignment ~xalign:0.5 ~yalign:0.5 ~packing:vbox1#add ()
- let asize =
- 245
- let area =
- GMisc.drawing_area ~width:asize ~height:asize ~packing:center#add ()
- let drawing =
- new GDraw.drawable (area#misc#realize (); area#misc#window)
- let statusbar =
- GMisc.statusbar ~has_resize_grip:true ~packing:vbox1#pack ()
- let dialog = GWindow.about_dialog
- ~authors:
- ["Game design by Cameron Browne & N\xC3\xA9stor Romeral Andr\xC3\xA9s";
- "Program by SpiceGuid (<[email protected]>)"]
- ~copyright:"Copyright \xC2\xA9 2026 SpiceGuid"
- ~license:"GNU General Public License v3"
- ~version:"0.1"
- ~website:"https://boardgamegeek.com/boardgame/112745/squava"
- ~website_label:"Board Game Geek : Squava"
- ~parent:window
- ~destroy_with_parent:true ()
- let sqr_size =
- 49
- let exposed _ =
- drawing#set_foreground `WHITE;
- drawing#rectangle ~x:0 ~y:0 ~width:asize ~height:asize ~filled:true ();
- drawing#set_foreground `BLACK;
- let y = ref 0 in
- while !y <= asize do
- drawing#line ~x:0 ~y:!y ~x:asize ~y:!y;
- y := !y + sqr_size;
- done;
- let x = ref 0 in
- while !x <= asize do
- drawing#line ~x:!x ~y:0 ~x:!x ~y:asize;
- x := !x + sqr_size;
- done;
- false
- let () =
- about#connect#clicked (fun () -> dialog#run (); dialog#misc#hide ());
- area#event#connect#expose ~callback:exposed;
- window#show ();
- GMain.main ()
Add Comment
Please, Sign In to add comment