Пример #1
0
        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();
            board.Draw(spriteBatch);
            player.Draw(spriteBatch);
            food.Draw(spriteBatch);

            spriteBatch.DrawString(font, "Score: " + score.ToString(), new Vector2(5, 5), Color.Black);

            //if game over draw reset text
            if (gameOver)
            {
                String  resetStr = "Press SPACE to Reset";
                Vector2 strSize  = font.MeasureString(resetStr);
                spriteBatch.DrawString(font, resetStr, new Vector2((windowWidth - strSize.X) / 2, (windowHeight - strSize.Y) / 2), Color.Black);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }