/*-------------------------------------------------------------------- * METHODS * --------------------------------------------------------------------*/ /*********************************************************** * * Method: * ms_field * * Description: * Constructor. * ***********************************************************/ public ms_field() { /*---------------------------------------------------------- * Initialize mine field * ----------------------------------------------------------*/ is_mine = false; is_clicked = false; mine_count = 0; mine_status = ms_mine_status.UNCHECKED; } /* ms_field() */
} /* init_complete() */ /*********************************************************** * * Method: * new_game * * Description: * Starts a new game. * ***********************************************************/ private void new_game ( int width, int height, int mine_count ) { /*---------------------------------------------------------- * Reset and start a new game * ----------------------------------------------------------*/ dims.reset(width, height); ms_ctlr.new_game(width, height, mine_count); /*---------------------------------------------------------- * Initialize image status variables * ----------------------------------------------------------*/ face_status = ms_face_status.ACTIVE; field_status = new ms_mine_status[width, height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { field_status[i, j] = new ms_mine_status(); field_status[i, j] = ms_model.mine_field[i, j].mine_status; } } /*---------------------------------------------------------- * Reset window size * ----------------------------------------------------------*/ graphics.PreferredBackBufferWidth = dims.view.Width; graphics.PreferredBackBufferHeight = dims.view.Height; graphics.ApplyChanges(); toolbar.configure(dims.toolbar, Color.White, menu_font); GraphicsDevice.Clear(Color.White); } /* new_game() */