Class TextRenderer.TextBuffer
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
A reusable fixed-size buffer for per-frame formatted text. Construct once, sized directly or from a worst-case template string, then into it each frame and pass it wherever is expected — no per-call allocations.
csharp
public sealed class TextRenderer.TextBufferInheritance
object ← TextRenderer.TextBuffer
Constructors
TextBuffer(int)
Creates a buffer with the given capacity in characters.
csharp
public TextBuffer(int capacity)Parameters
capacity int
TextBuffer(string)
Creates a buffer sized to fit the given worst-case example text.
csharp
public TextBuffer(string template)Parameters
template string
Methods
Format(ref FormatHandler)
Formats an interpolated string into the buffer without allocating, replacing the previous contents. Text that does not fit the buffer comes out empty.
csharp
public TextRenderer.TextMemory Format(ref TextRenderer.TextMemory.FormatHandler handler)Parameters
handler TextRenderer.TextMemory.FormatHandler
Returns
Operators
implicit operator TextMemory(TextBuffer)
Gets the most recently formatted text.
csharp
public static implicit operator TextRenderer.TextMemory(TextRenderer.TextBuffer buffer)Parameters
buffer TextRenderer.TextBuffer

