/// <summary> /// Calculates the center position for the given text on within a rectangle boundaries. /// </summary> /// <param name="rectangle">Rectangle boundaries</param> /// <param name="sprite">Sprite which is being drawn on</param> /// <param name="text">The Text</param> /// <param name="flags">Centered Flags</param> /// <returns>Returns the center position of the text on the rectangle.</returns> public static Vector2 GetCenteredText( this SharpDX.Rectangle rectangle, Sprite sprite, string text, CenteredFlags flags) { return(rectangle.GetCenter(sprite, Constants.LeagueSharpFont.MeasureText(sprite, text, 0), flags)); }
/// <summary> /// Calculates the center position for the given text on within a rectangle boundaries. /// </summary> /// <param name="rectangle">Rectangle boundaries</param> /// <param name="sprite">Sprite which is being drawn on</param> /// <param name="font">Text Font</param> /// <param name="text">The Text</param> /// <param name="flags">Centered Flags</param> /// <returns>Returns the center position of the text on the rectangle.</returns> public static Vector2 GetCenteredText( this SharpDX.Rectangle rectangle, Sprite sprite, Font font, string text, CenteredFlags flags) { return(font == null ? rectangle.GetCenteredText(sprite, text, flags) : rectangle.GetCenter(sprite, font.MeasureText(sprite, text, 0), flags)); }