API ReferenceSandbox.Rendering

HudPainterclass

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

objectHudPainter
Namespace
Sandbox.Rendering
Assembly
Sandbox.Engine
Declaration
public sealed struct Sandbox.Rendering.HudPainter

Constructors1

Showing 1 constructors

public HudPainter(Sandbox.Rendering.CommandList commandList)PUBLICCONSTRUCTOR

Initializes a new instance of the `Sandbox.Rendering.HudPainter` struct for the specified `commandList`.

ParameterTypeDescription
commandListCommandListThe command list to draw to. Must not be null.

Methods11

Showing 11 methods

public void DrawCircle(Vector2 position, Vector2 size, Color color)PUBLIC

Draws a filled circle at the specified position and size.

ParameterTypeDescription
positionVector2The center position of the circle.
sizeVector2The size (diameter) of the circle.
colorColorThe color of the circle.
Returns:void

public void DrawLine(Vector2 a, Vector2 b, float width, Color color, Vector4 corners = null)PUBLIC

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

ParameterTypeDescription
aVector2The start point of the line.
bVector2The end point of the line.
widthfloatThe width of the line.
colorColorThe color of the line.
corners = nullVector4Optional corner flags for line end caps.
Returns:void

public void DrawRect(Sandbox.Rect rect, Color color, Vector4 cornerRadius = null, Vector4 borderWidth = null, Color borderColor = null)PUBLIC

Draws a rectangle with optional corner radius and border.

ParameterTypeDescription
rectRectThe rectangle to draw.
colorColorThe fill color of the rectangle.
cornerRadius = nullVector4The radius for each corner (optional).
borderWidth = nullVector4The width of the border for each edge (optional).
borderColor = nullColorThe color of the border (optional).
Returns:void

public void SetBlendMode(Sandbox.BlendMode mode)PUBLIC

Sets the blend mode for subsequent drawing operations.

ParameterTypeDescription
modeBlendModeThe blend mode to use.
Returns:void

public void SetMatrix(Matrix matrix)PUBLIC

Sets the transformation matrix for subsequent drawing operations.

ParameterTypeDescription
matrixMatrixThe transformation matrix to apply.
Returns:void

On this page