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 DefaultScrollingTextRenderer : ElementRenderer
15 private static Color blackColor;
22 public override void RenderColor(UIElement element, UIRenderingContext context)
24 base.RenderColor(element, context);
28 if (scrollingText.Font == null || scrollingText.TextToDisplay == null)
31 var offset = scrollingText.ScrollingOffset;
32 var textWorldMatrix = element.WorldMatrix;
33 textWorldMatrix.M41 += textWorldMatrix.M11 * offset;
34 textWorldMatrix.M42 += textWorldMatrix.M12 * offset;
35 textWorldMatrix.M43 += textWorldMatrix.M13 * offset;
36 textWorldMatrix.M44 += textWorldMatrix.M14 * offset;
39 var drawCommand =
new SpriteFont.InternalUIDrawCommand
41 Color = scrollingText.RenderOpacity * scrollingText.TextColor,
42 DepthBias = context.DepthBias + 1,
43 FontScale = element.RealSizeVirtualResolutionRatio,
44 FontSize = scrollingText.TextSize,
46 SnapText = scrollingText.SnapText,
47 WorldMatrix = textWorldMatrix,
48 Alignment = TextAlignment.Left,
49 Size =
new Vector2(scrollingText.ActualWidth, scrollingText.ActualHeight)
56 Batch.Begin(ref UI.ViewProjectionInternal, GraphicsDevice.BlendStates.ColorDisabled, IncreaseStencilValueState, context.StencilTestReferenceValue);
57 Batch.DrawRectangle(ref element.WorldMatrixInternal, ref element.RenderSizeInternal, ref blackColor, context.DepthBias);
61 Batch.Begin(ref UI.ViewProjectionInternal, GraphicsDevice.BlendStates.AlphaBlend, KeepStencilValueState, context.StencilTestReferenceValue + 1);
66 Batch.Begin(ref UI.ViewProjectionInternal, GraphicsDevice.BlendStates.ColorDisabled, DecreaseStencilValueState, context.StencilTestReferenceValue + 1);
67 Batch.DrawRectangle(ref element.WorldMatrixInternal, ref element.RenderSizeInternal, ref blackColor, context.DepthBias+2);
71 Batch.Begin(ref UI.ViewProjectionInternal, GraphicsDevice.BlendStates.AlphaBlend, KeepStencilValueState, context.StencilTestReferenceValue);
SiliconStudio.Paradox.Games.Mathematics.Vector2 Vector2
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).
A text viewer that scrolls automatically the text from right to left.