Example #1
0
        //draws full Board
        public void Draw_Board(Graphics l)
        {
            Board board = game.GetBoard();

            //draw BG for playing Area
            Draw_Background(l);

            //Draws next Peace
            draw_nextPiece(game.GetNextPiece(), l);

            //displays Score
            display_score(game.GetScore(), l);
            //Lines to Clear
            display_linestoClear(game.GetLines(), l);
            //Draw Current Level
            display_Level(game.GetLevel(), l);

            //Draws each Piece int the Board
            foreach (KeyValuePair <Piece, char> position in board)
            {
                if (position.Key.Item1 < 0 || position.Key.Item1 > 9 || position.Key.Item2 < 0 || position.Key.Item2 > 19)
                {
                    continue;
                }

                Draw_Piece(position.Key.Item1, position.Key.Item2, board[position.Key], 30, l);
            }
        }
Example #2
0
        private void picBoard_Paint(object sender, PaintEventArgs e)
        {
            var board                 = game.GetBoard();
            var boardSize             = new Size(board.GetLength(1), board.GetLength(0));
            var boardCharacter        = game.GetBoardCharacter();
            var boardFreezedCharacter = game.GetBoardFreezedCharacter();

            for (int y = 0; y < boardSize.Height; y++)
            {
                for (int x = 0; x < boardSize.Width; x++)
                {
                    if (board[y, x] == boardCharacter)
                    {
                        continue;
                    }
                    var location     = new Point(x * 10, y * 10);
                    var blockElement = new Rectangle(location, blockElementSize);
                    if (board[y, x] == boardFreezedCharacter)
                    {
                        e.Graphics.FillRectangle(freezedBlockColor, blockElement);
                    }
                    else
                    {
                        e.Graphics.FillRectangle(activeBlockColor, blockElement);
                    }
                }
            }
        }