#open "windows";;
#open "camlwin";;




#open "ic_empty";;
#open "morpdsgn";;

let size = 2*(fst (image_size place_2_0.bm_bitmap));;
let delta = gr_to_win_coord (gr_to_real_coord (place_1_0.bm_left - place_0_0.bm_left)-size);;

let x1 = place_0_0.bm_left-delta;;
let y1 = place_0_0.bm_top+delta;;
let x2 = place_1_1.bm_left - delta;;
let y2 = place_1_1.bm_top + delta;;
let x3 = place_2_0.bm_left - delta;;
let y3 = place_0_2.bm_top + delta;;
let x4 = 2*x3-x2;;
let y4 = 2*y3-y2;;

let gamepad1 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = black;
  re_point    = ( x1, y1);
  re_width    = x4-x1;
  re_height   = y4-y1
};;

let gamepad2 =
{
  ln_window   = MorpionWin_def;
  ln_color    = black;
  ln_point1   = ( x1, y2);
  ln_point2   = ( x4, y2)
};;

let gamepad3 =
{
  ln_window   = MorpionWin_def;
  ln_color    = black;
  ln_point1   = ( x1, y3);
  ln_point2   = ( x4, y3)
};;

let gamepad4 =
{
  ln_window   = MorpionWin_def;
  ln_color    = black;
  ln_point1   = ( x2, y1);
  ln_point2   = ( x2, y4)
};;

let gamepad5 =
{
  ln_window   = MorpionWin_def;
  ln_color    = black;
  ln_point1   = ( x3, y1);
  ln_point2   = ( x3, y4)
};;

let rond_0_0 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_0_0.bm_left+8, place_0_0.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_0_0 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_0_0.bm_left, place_0_0.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_1_0 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_1_0.bm_left+8, place_1_0.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_1_0 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_1_0.bm_left, place_1_0.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_2_0 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_2_0.bm_left+8, place_2_0.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_2_0 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_2_0.bm_left, place_2_0.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_0_1 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_0_1.bm_left+8, place_0_1.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_0_1 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_0_1.bm_left, place_0_1.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_1_1 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_1_1.bm_left+8, place_1_1.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_1_1 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_1_1.bm_left, place_1_1.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_2_1 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_2_1.bm_left+8, place_2_1.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_2_1 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_2_1.bm_left, place_2_1.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_0_2 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_0_2.bm_left+8, place_0_2.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_0_2 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_0_2.bm_left, place_0_2.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_1_2 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_1_2.bm_left+8, place_1_2.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_1_2 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_1_2.bm_left, place_1_2.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_2_2 =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = transp;
  el_center   = (place_2_2.bm_left+8, place_2_2.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let square_2_2 =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = transp;
  re_point    = (place_2_2.bm_left, place_2_2.bm_top-16);
  re_width    = 16;
  re_height   = 16
};;

let rond_player =
{
  el_window   = MorpionWin_def;
  el_filled   = false;
  el_color    = black;
  el_center   = (95, 59);
  el_xray     = 8;
  el_yray     = 8
};;

let square_caml =
{
  re_window   = MorpionWin_def;
  re_filled   = false;
  re_color    = black;
  re_point    = (87, 31);
  re_width    = 16;
  re_height   = 16
};;

let menu18 = 
{
  mn_window   = MorpionWin_def;
  mn_left     = 0;
  mn_top      = 0;
  mn_nu_item  = 0;
  mn_hide_area= gr_empty_image;
  mn_name     = "Configuration";
  mn_state    = Unvisible;
  mn_items    = [|
                 config_turn
                |]
};;

let toolbar = 
{
  tb_window   = MorpionWin_def;
  tb_items    = [|
                 menu18;
                 menu17
                |]
};;

let MorpionWinBW = 
{
  win_def      = MorpionWin_def;
  win_objects  = [
                  g_rectangle gamepad1;
                  g_line      gamepad2;
                  g_line      gamepad3;
                  g_line      gamepad4;
                  g_line      gamepad5;
                  g_bitmap    place_0_0;
                  g_bitmap    place_1_0;
                  g_bitmap    place_2_0;
                  g_bitmap    place_0_1;
                  g_bitmap    place_1_1;
                  g_bitmap    place_2_1;
                  g_bitmap    place_0_2;
                  g_bitmap    place_1_2;
                  g_bitmap    place_2_2;
                  g_ellipse   rond_0_0;
                  g_ellipse   rond_1_0;
                  g_ellipse   rond_2_0;
                  g_ellipse   rond_0_1;
                  g_ellipse   rond_1_1;
                  g_ellipse   rond_2_1;
                  g_ellipse   rond_0_2;
                  g_ellipse   rond_1_2;
                  g_ellipse   rond_2_2;
                  g_rectangle   square_0_0;
                  g_rectangle   square_1_0;
                  g_rectangle   square_2_0;
                  g_rectangle   square_0_1;
                  g_rectangle   square_1_1;
                  g_rectangle   square_2_1;
                  g_rectangle   square_0_2;
                  g_rectangle   square_1_2;
                  g_rectangle   square_2_2;
                  g_ellipse   rond_player;
                  g_rectangle   square_caml;
                  g_helpbar   help;
                  g_prompt    player_prt;
                  g_prompt    caml_ptr;
                  g_button    quit_button;
                  g_toolbar   toolbar
                 ];
  time_callback = gr_do_nothing;
  resize_callback = gr_do_nothing;
  help_file = "";
  miscellaneous = [| |]
};;

quit_button.bt_callback <- gr_quit_callback;;

