示例#1
0
        /// <summary>
        /// Submit a text string of sprites for drawing in the current batch.
        /// </summary>
        /// <param name="spriteFont">A font.</param>
        /// <param name="text">The text which will be drawn.</param>
        /// <param name="position">The drawing location on screen.</param>
        /// <param name="color">A color mask.</param>
        /// <param name="rotation">A rotation of this string.</param>
        /// <param name="origin">Center of the rotation. 0,0 by default.</param>
        /// <param name="scale">A scaling of this string.</param>
        /// <param name="effects">Modificators for drawing. Can be combined.</param>
        /// <param name="layerDepth">A depth of the layer of this string.</param>
        public static void DrawString(this SpriteBatch spriteBatch, BitmapFont bitmapFont, string text, Vector2 position, Color color,
                                      float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth)
        {
            var source = new BitmapFont.CharacterSource(text);

            bitmapFont.drawInto(spriteBatch, ref source, position, color, rotation, origin, scale, effects, layerDepth);
        }
示例#2
0
        /// <summary>
        /// Submit a text string of sprites for drawing in the current batch.
        /// </summary>
        /// <param name="spriteFont">A font.</param>
        /// <param name="text">The text which will be drawn.</param>
        /// <param name="position">The drawing location on screen.</param>
        /// <param name="color">A color mask.</param>
        public static void DrawString(this SpriteBatch spriteBatch, BitmapFont bitmapFont, string text, Vector2 position, Color color)
        {
            var source = new BitmapFont.CharacterSource(text);

            bitmapFont.drawInto(
                spriteBatch, ref source, position, color, 0, Vector2.Zero, Vector2.One, SpriteEffects.None, 0f);
        }
示例#3
0
        /// <summary>
        /// Returns the size of the contents of a StringBuilder when rendered in this font.
        /// </summary>
        /// <returns>The string.</returns>
        /// <param name="text">Text.</param>
        public Vector2 measureString(StringBuilder text)
        {
            var     source = new BitmapFont.CharacterSource(text);
            Vector2 size;

            measureString(ref source, out size);
            return(size);
        }