Example #1
0
        public TPiece(PrimitiveLine blockBrush)
            : base(blockBrush)
        {
            rotationList.Add(new int[,] {      {0,0,0,0},
                                               {0,1,1,1},
                                               {0,0,1,0},
                                               {0,0,0,0}  });

            rotationList.Add(new int[,] {      {0,0,1,0},
                                               {0,0,1,1},
                                               {0,0,1,0},
                                               {0,0,0,0}  });

            rotationList.Add(new int[,] {      {0,0,1,0},
                                               {0,1,1,1},
                                               {0,0,0,0},
                                               {0,0,0,0}  });

            rotationList.Add(new int[,] {      {0,0,1,0},
                                               {0,1,1,0},
                                               {0,0,1,0},
                                               {0,0,0,0}  });

            pieceColor = Color.Indigo;
            base.Setup();
        }
Example #2
0
        public NatrisBoard()
        {
            widthInPixels = (Constants.gridWidth * Constants.blocksize) + 2 * Constants.innerBoardPadding + (Constants.gridWidth + 1) * Constants.blockPadding;
            heightInPixels = (Constants.gridHeight * Constants.blocksize) + 2 * Constants.innerBoardPadding + (Constants.gridHeight + 1) * Constants.blockPadding;

            CellMap = new int[Constants.gridWidth, Constants.gridHeight, 2];
            blockBrush = new PrimitiveLine(Engine.graphicsDevice, Engine.spriteBatch, Color.White);
            ClearBoard();
            currentPiece = GetNewRandomPiece();
            nextPiece = GetNewRandomPiece();
            nextPiece.setPreview(true);
        }
Example #3
0
        public GameScreen()
        {
            gameBoard = new NatrisBoard();

            uiRects = new List<Rectangle>();
            uiRects.Add(new Rectangle((int)gameBoardOffset.X, (int)gameBoardOffset.Y, gameBoard.Width, gameBoard.Height)); //the outside of the game board
            uiRects.Add(new Rectangle(380, 20, 260, 60));
            uiRects.Add(new Rectangle(380, 100, 260, 260));
            uiRects.Add(new Rectangle(380, 400, 260, 260));

            myUIBrush = new PrimitiveLine(Engine.graphicsDevice, Engine.spriteBatch, Color.Blue);
            myFont = Engine.myContent.Load<SpriteFont>("UIMono24");
        }
Example #4
0
 public BasePiece(PrimitiveLine BlockBrush)
 {
     rotationList = new List<int[,]>();
     rotationIndex = 1;
     blockBrush = BlockBrush;
 }
Example #5
0
        public void CreateRectangle(Rectangle myRectangle)
        {
            Vector2 TopLeft = new Vector2(myRectangle.Left, myRectangle.Top);
            Vector2 TopRight = new Vector2(myRectangle.Right, myRectangle.Top);
            Vector2 BottomLeft = new Vector2(myRectangle.Left, myRectangle.Bottom);
            Vector2 BottomRight = new Vector2(myRectangle.Right, myRectangle.Bottom);

            PrimitiveLine Topbrush = new PrimitiveLine(graphicsDevice,spriteBatch, Colour);
            Topbrush.AddVector(TopLeft);
            Topbrush.AddVector(TopRight);

            PrimitiveLine Bottombrush = new PrimitiveLine(graphicsDevice, spriteBatch, Colour);
            Bottombrush.AddVector(BottomLeft);
            Bottombrush.AddVector(BottomRight);

            PrimitiveLine Leftbrush = new PrimitiveLine(graphicsDevice, spriteBatch, Colour);
            Leftbrush.AddVector(TopLeft);
            Leftbrush.AddVector(BottomLeft);

            PrimitiveLine Rightbrush = new PrimitiveLine(graphicsDevice, spriteBatch, Colour);
            Rightbrush.AddVector(BottomRight);
            Rightbrush.AddVector(TopRight);

            Topbrush.Render(spriteBatch);
            Bottombrush.Render(spriteBatch);
            Leftbrush.Render(spriteBatch);
            Rightbrush.Render(spriteBatch);
        }