コード例 #1
0
        /// <summary>
        /// Draws the text centralized in the Y coordinate.
        /// </summary>
        /// <param name="textSystem">The text system.</param>
        /// <param name="x">The x.</param>
        /// <param name="text">The text.</param>
        /// <param name="bounds">The bounds.</param>
        /// <param name="color">The text color.</param>
        /// <param name="fontName">Name of the font.</param>
        /// <returns>The text system.</returns>
        public static ITextSystem DrawCenterY(this ITextSystem textSystem, float x, string text, Rectangle bounds, Color color, string fontName = null)
        {
            var size         = textSystem.GetFont(fontName).GetTextSize(text);
            var boundsCenter = bounds.GetCenter();
            var y            = boundsCenter.Y - (size.Y / 2);

            return(textSystem.Draw(x, y, text, color, fontName));
        }