Implements abstract multi-render font
コード例 #1
0
ファイル: FNARenderer.cs プロジェクト: EmptyKeys/UI_Engines
        /// <summary>
        /// Draws the text.
        /// </summary>
        /// <param name="font">The font.</param>
        /// <param name="text">The text.</param>
        /// <param name="position">The position.</param>
        /// <param name="renderSize">Size of the render.</param>
        /// <param name="color">The color.</param>
        /// <param name="scale">The scale.</param>
        /// <param name="depth">The depth.</param>
        public override void DrawText(FontBase font, string text, PointF position, Size renderSize, ColorW color, PointF scale, float depth)
        {
            if (isClipped)
            {
                testRectangle.X = (int)position.X;
                testRectangle.Y = (int)position.Y;
                testRectangle.Width = (int)renderSize.Width;
                testRectangle.Height = (int)renderSize.Height;

                if (!spriteBatch.GraphicsDevice.ScissorRectangle.Intersects(testRectangle))
                {
                    return;
                }
            }

            vecPosition.X = position.X;
            vecPosition.Y = position.Y;
            vecScale.X = scale.X;
            vecScale.Y = scale.Y;
            vecColor.PackedValue = color.PackedValue;
            SpriteFont native = font.GetNativeFont() as SpriteFont;
            spriteBatch.DrawString(native, text, vecPosition, vecColor);
        }
コード例 #2
0
ファイル: Renderer.cs プロジェクト: EmptyKeys/UI_Engines
 /// <summary>
 /// Draws the text.
 /// </summary>
 /// <param name="font">The font.</param>
 /// <param name="text">The text.</param>
 /// <param name="position">The position.</param>
 /// <param name="renderSize">Size of the render.</param>
 /// <param name="color">The color.</param>
 /// <param name="scale">The scale.</param>
 /// <param name="depth">The depth.</param>
 public abstract void DrawText(FontBase font, string text, PointF position, Size renderSize, ColorW color, PointF scale, float depth);