Beispiel #1
0
        static void Main(string[] args)
        {
            //fixedBlocks anders invullen, want property hoort private te zijn

            var field = new Field(3,3);
            field.fixedBlocks = new Grid(
                new Square[,] {
                    {_,_,_},
                    {_,_,_},
                    {x,_,_}
            });
            field.Position = new Vector2(1,1);

            var block = new Block(); //!!moet interface worden
            block.vectors = new List<Vector2>
            {
                new Vector2(0,1), //ToSelf: let op [x,y] , niet [y,x] overigens
                new Vector2(1,0)
            };
            block.squareType = x;
            field.Block = block;

            bool ClippingOccured = false;
            Grid gridSuperposition = field.getSuperposition(out ClippingOccured);

            var gridForCheck = new Grid(
                new Square[,] {
                    {_,_,_},
                    {_,_,x},
                    {x,x,_}
            });

            bool r = gridSuperposition.Equals(gridForCheck);
            bool c = ClippingOccured;
        }
Beispiel #2
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.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            blockTexture = Content.Load<Texture2D>("Block");

            emptyBackgroundTexture = new Texture2D(GraphicsDevice, 1, 1);
            emptyBackgroundTexture.SetData(new Color[] { Color.White });

            numberOfRows = (GraphicsDevice.Viewport.Height - 60) / blockTexture.Height;

            field = new Field(12, numberOfRows, new BlockCollisionDetector());
            gameMechanics = new GameMechanics(field, new BlockFactory());
        }