// initialize game stuff private void initializeGame() { // create board BoardDrawables board_dc = new BoardDrawables { active_line = Color.Black, inactive_line = Color.LightGray, background = Color.LemonChiffon }; board = new Board(board_p, rowcnt_t, colcnt_t, board_dc); player = new Player[player_cnt]; // create player 1 PlayerDrawables player1_dc = new PlayerDrawables { player_p = player1_p, name_t = player1_name_t, cells_l = player1_cells_l, cell_cnt_l = player1_cell_cnt_l, score_l = player1_score_l, score_cnt_l = player1_score_cnt_l, amblem = new AmblemX(Color.PowderBlue, Color.Black), active_frgnd = Color.PowderBlue, active_bkgnd = Color.RoyalBlue }; player[0] = new Player(0, player1_dc); // create player 2 PlayerDrawables player2_dc = new PlayerDrawables { player_p = player2_p, name_t = player2_name_t, cells_l = player2_cells_l, cell_cnt_l = player2_cell_cnt_l, score_l = player2_score_l, score_cnt_l = player2_score_cnt_l, amblem = new AmblemO(Color.Orange, Color.Black), active_frgnd = Color.Orange, active_bkgnd = Color.Coral }; player[1] = new Player(1, player2_dc); // set player active statuses player[0].setActiveStatus(true); player[1].setActiveStatus(false); }
// create a board public Board(Panel panel, TextBox rowcnt_t, TextBox colcnt_t, BoardDrawables drawables) { // initializing board components this.panel = panel; this.rowcnt_t = rowcnt_t; this.colcnt_t = colcnt_t; // initializing drawables panel.BackColor = Color.Transparent; this.drawables = drawables; brush = new SolidBrush(drawables.background); pen = new Pen(drawables.inactive_line); // initializing board initialize(); // setting panel event handlers panel.Paint += panel_paint_h = new PaintEventHandler(panel_Paint); panel.Resize += panel_resize_h = new EventHandler(panel_Resize); }