Api Sandbox Rendering HudPainter
struct

HudPainter

public sealed struct HudPainter

2D Drawing functions for a CommandList. HudPainter provides a set of methods for drawing shapes, textures, and text onto a command list, typically for HUD or UI rendering.

Constructors

HudPainter(CommandList commandList)

Initializes a new instance of the HudPainter struct for the specified .

commandList — The command list to draw to. Must not be null.

Methods

Void SetBlendMode(BlendMode mode)

Sets the blend mode for subsequent drawing operations.

mode — The blend mode to use.
Void SetMatrix(Matrix matrix)

Sets the transformation matrix for subsequent drawing operations.

matrix — The transformation matrix to apply.
Void DrawCircle(Vector2 position, Vector2 size, Color color)

Draws a filled circle at the specified position and size.

position — The center position of the circle.
size — The size (diameter) of the circle.
color — The color of the circle.
Void DrawRect(Rect rect, Color color, Vector4 cornerRadius = null, Vector4 borderWidth = null, Color borderColor = null)

Draws a rectangle with optional corner radius and border.

rect — The rectangle to draw.
color — The fill color of the rectangle.
cornerRadius — The radius for each corner (optional).
borderWidth — The width of the border for each edge (optional).
borderColor — The color of the border (optional).
Void DrawTexture(Texture texture, Rect rect)

Draws a texture in the specified rectangle with a white tint.

texture — The texture to draw.
rect — The rectangle to draw the texture in.
Void DrawTexture(Texture texture, Rect rect, Color tint)

Draws a texture in the specified rectangle with a tint color.

texture — The texture to draw.
rect — The rectangle to draw the texture in.
tint — The tint color to apply to the texture.
Void DrawText(String text, Single size, Color color, Vector2 point, TextFlag flags = 33)

Draws text at a 3D point with the specified size, color, and alignment flags.

text — The text to draw.
size — The font size.
color — The color of the text.
point — The 3D point to draw the text at.
flags — Text alignment flags (optional).
Void DrawText(String text, Single size, Color color, Rect rect, TextFlag flags = 33)

Draws text within a rectangle with the specified size, color, and alignment flags.

text — The text to draw.
size — The font size.
color — The color of the text.
rect — The rectangle to draw the text in.
flags — Text alignment flags (optional).
Rect DrawText(Scope scope, Vector2 point, TextFlag flags = 33)

Draws text at a 3D point using a prepared Scope.

scope — The text rendering scope.
point — The 3D point to draw the text at.
flags — Text alignment flags (optional).
Rect DrawText(Scope scope, Rect rect, TextFlag flags = 33)

Draws text within a rectangle using a prepared Scope.

scope — The text rendering scope.
rect — The rectangle to draw the text in.
flags — Text alignment flags (optional).
Void DrawLine(Vector2 a, Vector2 b, Single width, Color color, Vector4 corners = null)

Draws a line between two points with the specified width and color.

a — The start point of the line.
b — The end point of the line.
width — The width of the line.
color — The color of the line.
corners — Optional corner flags for line end caps.

Fields

Name Type Description
list CommandList The underlying CommandList used for rendering.
Assembly: Sandbox.Engine Namespace: Sandbox.Rendering Full Name: Sandbox.Rendering.HudPainter