Vertex Docs

VertexScreen.Draw.rect(surface, color, rect=None)

Description: Draws a solid-colored rectangle on the specified surface. When a rectangle area is provided, the rectangle is drawn at the given position and size. If rect is set to None, the rectangle fills the entire surface. This method is commonly used for backgrounds, panels, UI elements, and screen clearing.

Usage

from VertexEngine import VertexScreen

vs = VertexScreen()

# Fill the entire surface with a background color
vs.Draw.rect(surface, (30, 30, 30))

# Draw a UI panel
vs.Draw.rect(
    surface,
    (0, 120, 255),
    rect=(100, 80, 300, 200)
)

Parameters

Returns

None — This method draws directly onto the surface and does not return a value.

Notes