Пример #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin();
            // Draw the background
            spriteBatch.Draw(background, new Rectangle(0, 0, 800, 600), Color.White);
            // Draw the ghost piece
            currentTetromino?.DrawGhost(spriteBatch, BoardLocation);
            // Draw the board
            gameBoard.Draw(spriteBatch, BoardLocation, texture1px);
            for (int k = 0; k < nextBlockBoards.Length; k++)
            {
                nextBlockBoards[k].Draw(spriteBatch, nextBlockBoardsLocation[k], texture1px);
            }

            // Draw Game Info

            // Score
            spriteBatch.DrawString(GameFont, String.Format("Score: {0}", Score), new Vector2(50, 60), Color.White);
            // Level
            spriteBatch.DrawString(GameFont, String.Format("Level: {0}", Level), new Vector2(50, 110), Color.White);
            // Lines
            spriteBatch.DrawString(GameFont, String.Format("Lines: {0}", Lines), new Vector2(50, 160), Color.White);


            if (GameOver)
            {
                // Draw game over screen
                spriteBatch.DrawString(GameFont, "Game Over!\nPress Enter to restart.", new Vector2(50, 210), Color.Red);
            }

            // Display the debug Window
            //DrawDebugWindow(spriteBatch);

            spriteBatch.End();
            base.Draw(gameTime);
        }