FastTextRenderer Class
Namespace: Stride.GraphicsAssembly: Stride.Graphics.dll
Renders text with a fixed size font.
public class FastTextRenderer : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Name | Description | |
---|---|---|
Constructors | ||
FastTextRenderer(GraphicsContext, Int32) | ||
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 |
|
DebugSpriteHeight | Height of font Texture DebugSpriteFont. |
|
DebugSpriteWidth | Width of font Texture DebugSpriteFont. |
|
GlyphHeight | Height of a single glyph of font DebugSpriteFont. |
|
GlyphWidth | Width of a single glyph of font DebugSpriteFont. |
|
MatrixTransform | A general matrix transformation for the text. Should include view and projection if needed. |
|
TextColor | Sets or gets the color to use when drawing the text. |
|
Methods | ||
Begin(GraphicsContext) | Begins text rendering (swaps and maps the vertex buffer to write to). |
|
Destroy() | ||
DrawString(GraphicsContext, String, Int32, Int32) | Adds a string to be drawn once End() is called. |
|
End(GraphicsContext) | Begins text rendering (swaps and maps the vertex buffer to write to). |
Constructors
FastTextRenderer(GraphicsContext, Int32)
public FastTextRenderer(GraphicsContext graphicsContext, int maxCharacterCount = 7000)
Parameters
Type | Name | Description |
---|---|---|
GraphicsContext | graphicsContext | |
System.Int32 | maxCharacterCount |
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
Type | Description |
---|---|
Texture |
DebugSpriteHeight
Height of font Texture DebugSpriteFont.
public int DebugSpriteHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
DebugSpriteWidth
Width of font Texture DebugSpriteFont.
public int DebugSpriteWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
GlyphHeight
Height of a single glyph of font DebugSpriteFont.
public int GlyphHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
GlyphWidth
Width of a single glyph of font DebugSpriteFont.
public int GlyphWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MatrixTransform
A general matrix transformation for the text. Should include view and projection if needed.
public Matrix MatrixTransform { get; set; }
Property Value
Type | Description |
---|---|
Matrix |
TextColor
Sets or gets the color to use when drawing the text.
public Color4 TextColor { get; set; }
Property Value
Type | Description |
---|---|
Color4 |
Methods
Begin(GraphicsContext)
Begins text rendering (swaps and maps the vertex buffer to write to).
public void Begin(GraphicsContext graphicsContext)
Parameters
Type | Name | Description |
---|---|---|
GraphicsContext | graphicsContext | The current GraphicsContext. |
Destroy()
protected override void Destroy()
Overrides
DrawString(GraphicsContext, String, Int32, Int32)
Adds a string to be drawn once End() is called.
public void DrawString(GraphicsContext graphicsContext, string text, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
GraphicsContext | graphicsContext | The current GraphicsContext. |
System.String | text | The text to draw. Should not be modified until call to End. |
System.Int32 | x | Position of the text on the X axis (in viewport space). |
System.Int32 | y | Position 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
Type | Name | Description |
---|---|---|
GraphicsContext | graphicsContext | The current GraphicsContext. |