The DrawText
method in the HudPainter
class is used to render text at a specified 3D point on the HUD (Heads-Up Display). This method is part of the Sandbox.Rendering
namespace and is designed to work with the text rendering system in s&box.
The DrawText
method in the HudPainter
class is used to render text at a specified 3D point on the HUD (Heads-Up Display). This method is part of the Sandbox.Rendering
namespace and is designed to work with the text rendering system in s&box.
To use the DrawText
method, you need to provide a Scope
reference, a Vector3
point where the text should be drawn, and a set of TextFlag
options that define how the text should be rendered.
The Scope
parameter is a reference to a text rendering scope, which manages the context for text rendering operations. The point
parameter specifies the 3D coordinates on the HUD where the text will appear. The flags
parameter allows you to specify various rendering options, such as alignment and styling.
// Example usage of HudPainter.DrawText // Assume 'hudPainter' is an instance of HudPainter // 'scope' is a valid TextRendering.Scope reference // 'position' is a Vector3 specifying the text position // 'textFlags' is a combination of TextFlag options hudPainter.DrawText(ref scope, new Vector3(100, 200, 0), TextFlag.Center | TextFlag.Bold);