Esempio n. 1
0
        /// <summary>
        /// Creates an instance of the game wrapper
        /// </summary>
        /// <param name="game">Game instance to wrap</param>
        /// <param name="parameters">Parameters to initialize the game wrapper</param>
        public GameWrapper(Game game, GameWrapperParams parameters)
        {
            Game = game ?? throw new ArgumentNullException();

            GameCanvas  = new GridCanvas(game.Map.Size, game.Map.Size, parameters.GameCanvasWidth, parameters.GameCanvasHeight);
            LabelCanvas = new GridCanvas(game.Map.Size, LABEL_HEIGHT, parameters.LabelCanvasWidth, parameters.LabelCanvasHeight);
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the main form load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            var gameWrapperParams = new GameWrapperParams
            {
                GameCanvasWidth   = MainPictureBox.Width,
                GameCanvasHeight  = MainPictureBox.Height,
                LabelCanvasWidth  = LabelPictureBox.Width,
                LabelCanvasHeight = LabelPictureBox.Height
            };

            GameWrapper = new GameWrapper(new Game(GAME_MAP_SIZE), gameWrapperParams);
            GameWrapper.Game.Victory += Game_Victory;
        }