Beispiel #1
0
        /// <summary>
        /// write something on the screen
        /// </summary>
        /// <param name="text">the text to write on the screen</param>
        /// <param name="position">where to write at... either upper left, upper center, or upper right, depending on justication</param>
        /// <param name="justification">how to justify the text</param>
        /// <param name="scale">how big to write.  This is not a point size to draw at, it is a multiple of the default font size!</param>
        /// <param name="color">the color to draw the text</param>
        /// <param name="spriteBatch">spritebatch to use to render the text</param>
        /// <param name="time">Most of the other font buddy classes use time somehow, but can jsut send in 0.0f for this dude or ignoer it</param>
        protected float DrawText(string text,
                                 Vector2 position,
                                 Justify justification,
                                 float scale,
                                 Color color,
                                 SpriteBatch spriteBatch,
                                 GameClock time)
        {
            //if this thing is empty, dont do anything
            if (string.IsNullOrEmpty(text))
            {
                return(position.X);
            }

            position = LineFormatter.JustifiedPosition(text, position, justification, scale, this);

            //okay, draw the actual string
            DrawString(text, position, scale, color, spriteBatch);

            //return the end of that string
            return(position.X + (MeasureString(text).X *scale));
        }
Beispiel #2
0
 public bool NeedsToShrink(string text, float scale, int rowWidth)
 {
     return(LineFormatter.NeedsToShrink(text, scale, rowWidth, this));
 }
Beispiel #3
0
 public float ShrinkToFit(string text, int rowWidth)
 {
     return(LineFormatter.ShrinkToFit(text, rowWidth, this));
 }
Beispiel #4
0
 public List <string> BreakTextIntoList(string text, int rowWidth)
 {
     return(LineFormatter.BreakTextIntoList(text, rowWidth, this));
 }