Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            this.spriteBatch       = new SpriteBatch(this.GraphicsDevice);
            this.State.SpriteBatch = this.spriteBatch;

            Board.LoadTextures(this.Content);
            Tile.LoadTextures(this.Content);
            ControlArea.LoadTextures(this.Content);
        }
Beispiel #2
0
        internal void SetSize(int gridSize)
        {
            if (this.GridSize != gridSize)
            {
                int diff = this.GridSize - gridSize;

                this.GridSize = gridSize;

                this.board       = new Board(this.GridSize);
                this.controlArea = new ControlArea(this.GridSize);

                this.graphics.PreferredBackBufferHeight = (this.GridSize + 1) * TileSize + BottomAreaSize;
                this.graphics.PreferredBackBufferWidth  = (this.GridSize + 1) * 2 * TileSize;
                this.graphics.ApplyChanges();

                this.Window.Position = new Point(this.Window.Position.X + diff * TileSize, this.Window.Position.Y + diff * HalfTileSize);
            }

            this.PopulateBoard();
        }