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.
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)
)
surface (Surface):
The surface on which the rectangle will be drawn, such as the main
display surface or an off-screen rendering buffer.
color (tuple):
The color of the rectangle, specified as an RGB
(R, G, B) or RGBA (R, G, B, A) tuple.
rect (tuple, optional):
A rectangle defined as (x, y, width, height).
If omitted or set to None, the rectangle fills
the entire surface.
None — This method draws directly onto the surface and does not return a value.