public override void FriendFoeInitialisation() { int[,] friend_foe = new int[glb_settings.get_map_dim_parameter_x(), glb_settings.get_map_dim_parameter_y()]; for (int i = 0; i < glb_settings.get_map_dim_parameter_x(); i++) { for (int j = 0; j < glb_settings.get_map_dim_parameter_y(); j++) { if (i < glb_settings.get_map_dim_parameter_x() / 2) { friend_foe[i, j] = (int)FriendFoeKind.friend; } else { friend_foe[i, j] = (int)FriendFoeKind.foe; } } } FriendFoe = friend_foe; }
public override void DrawGrid() { //set color var c = Color.Black; var pen = new System.Drawing.Pen(c); //draw actual grid for (int i = 0; i <= glb_settings.get_map_dim_parameter_x(); i++) { graph.DrawLine(pen, i * glb_settings.get_map_box_size(), 0, i * glb_settings.get_map_box_size(), glb_settings.get_map_dim_parameter_y() * glb_settings.get_map_box_size()); } for (int j = 0; j <= glb_settings.get_map_dim_parameter_y(); j++) { graph.DrawLine(pen, 0, j * glb_settings.get_map_box_size(), glb_settings.get_map_dim_parameter_x() * glb_settings.get_map_box_size(), j * glb_settings.get_map_box_size()); } }
private void btn_start_Click(object sender, EventArgs e) { //initialise global settings object glb_settings.set_map_dim_parameters(Convert.ToInt32(txt_global_x.Text), Convert.ToInt32(txt_global_y.Text)); Board frm = new Board(); //pass global variables class to the 2nd form frm.glb_settings = glb_settings; //temp board dimentions in pxls int x = glb_settings.get_map_dim_parameter_x() * glb_settings.get_map_box_size() + glb_settings.get_map_menu_offset() + glb_settings.get_map_box_size(); int y = glb_settings.get_map_dim_parameter_y() * glb_settings.get_map_box_size() + 2 * glb_settings.get_map_box_size(); //set dynamic board size frm.SetDesktopBounds(0, 0, x, y); frm.ShowDialog(); }