Class FastTextRenderer
Renders text with a fixed size font.
public class FastTextRenderer : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
- Inheritance
-
FastTextRenderer
- Implements
- Inherited Members
- Extension Methods
Constructors
FastTextRenderer(GraphicsContext, int)
public FastTextRenderer(GraphicsContext graphicsContext, int maxCharacterCount = 7000)
Parameters
graphicsContext
GraphicsContextmaxCharacterCount
int
Properties
DebugSpriteFont
Sets or gets the sprite font texture to use when drawing the text. The sprite font must have fixed size of DebugSpriteWidth and DebugSpriteHeight and each glyph should have uniform size of GlyphWidth and GlyphHeight
public Texture DebugSpriteFont { get; set; }
Property Value
DebugSpriteHeight
Height of font Texture DebugSpriteFont.
public int DebugSpriteHeight { get; set; }
Property Value
DebugSpriteWidth
Width of font Texture DebugSpriteFont.
public int DebugSpriteWidth { get; set; }
Property Value
GlyphHeight
Height of a single glyph of font DebugSpriteFont.
public int GlyphHeight { get; set; }
Property Value
GlyphWidth
Width of a single glyph of font DebugSpriteFont.
public int GlyphWidth { get; set; }
Property Value
MatrixTransform
A general matrix transformation for the text. Should include view and projection if needed.
public Matrix MatrixTransform { get; set; }
Property Value
TextColor
Sets or gets the color to use when drawing the text.
public Color4 TextColor { get; set; }
Property Value
Methods
Begin(GraphicsContext)
Begins text rendering (swaps and maps the vertex buffer to write to).
public void Begin(GraphicsContext graphicsContext)
Parameters
graphicsContext
GraphicsContextThe current GraphicsContext.
Destroy()
Disposes of object resources.
protected override void Destroy()
DrawString(GraphicsContext, string, int, int)
Adds a string to be drawn once End() is called.
public void DrawString(GraphicsContext graphicsContext, string text, int x, int y)
Parameters
graphicsContext
GraphicsContextThe current GraphicsContext.
text
stringThe text to draw. Should not be modified until call to End.
x
intPosition of the text on the X axis (in viewport space).
y
intPosition of the text on the Y axis (in viewport space).
End(GraphicsContext)
Begins text rendering (swaps and maps the vertex buffer to write to).
public void End(GraphicsContext graphicsContext)
Parameters
graphicsContext
GraphicsContextThe current GraphicsContext.
GraphicsFastTextRendererGenerateVertices(RectangleF, RectangleF, string, ref int, Span<VertexPositionNormalTexture>)
public void GraphicsFastTextRendererGenerateVertices(RectangleF constantInfos, RectangleF renderInfos, string textPointer, ref int textLength, Span<VertexPositionNormalTexture> vertexBuffer)
Parameters
constantInfos
RectangleFrenderInfos
RectangleFtextPointer
stringtextLength
intvertexBuffer
Span<VertexPositionNormalTexture>