3 using SiliconStudio.Core;
4 using SiliconStudio.Core.Mathematics;
5 using SiliconStudio.Paradox.Graphics;
6 using SiliconStudio.Paradox.UI.Controls;
8 namespace SiliconStudio.
Paradox.UI.Renderers
13 internal class DefaultTextBlockRenderer : ElementRenderer
20 public override void RenderColor(UIElement element, UIRenderingContext context)
22 base.RenderColor(element, context);
26 if (textBlock.Font == null || textBlock.TextToDisplay == null)
29 var drawCommand =
new SpriteFont.InternalUIDrawCommand
31 Color = textBlock.RenderOpacity * textBlock.TextColor,
32 DepthBias = context.DepthBias,
33 FontScale = element.RealSizeVirtualResolutionRatio,
34 FontSize = textBlock.TextSize,
36 SnapText = textBlock.SnapText,
37 WorldMatrix = textBlock.WorldMatrixInternal,
39 Size =
new Vector2(textBlock.ActualWidth, textBlock.ActualHeight)
42 Batch.DrawString(
textBlock.Font, textBlock.TextToDisplay, ref drawCommand);
SiliconStudio.Paradox.Games.Mathematics.Vector2 Vector2
TextAlignment
Specify the available text alignment when rendering text.
A service registry is a IServiceProvider that provides methods to register and unregister services...
SharpDX.DirectWrite.Font Font
Represents a 32-bit color (4 bytes) in the form of RGBA (in byte order: R, G, B, A).
Provides a lightweight control for displaying small amounts of text.