예제 #1
0
        private void DrawText(SpriteBatch spriteBatch)
        {
            // Draw the text within the node itself, and position it in the center within each row
            var rows = DescriptionText.Split('\n');

            var drawLocation = new Vector2(0, Location.Y - _nodeFont.MeasureString(DescriptionText).Y / 2 + Size.Y / 2);

            foreach (var row in rows)
            {
                drawLocation.X = Location.X - _nodeFont.MeasureString(row).X / 2 + Size.X / 2;
                spriteBatch.DrawString(_nodeFont, row, drawLocation, Color.Black * Opacity);

                drawLocation.Y += _nodeFont.MeasureString(row).Y;
            }
        }