surface.DrawRect

From Garry's Mod
Jump to: navigation, search
 surface.DrawRect( )

Contents

Description

Draws a solid rectangle on the screen.

NOTE

This is a rendering function that requires a 2D rendering context.
This means that it will only work in hooks with a 2D rendering context.

Arguments

number x

The X integer co-ordinate.

Arguments

number y

The Y integer co-ordinate.

Arguments

number width

The integer width of the rectangle.

Arguments

number height

The integer height of the rectangle.

Examples

Example

Draws a white 100 by 100 rectangle, 25 pixels from the top left of the screen.

hook.Add("HUDPaint", "MyRect", function()
    surface.SetDrawColor(255,255,255,255)
    surface.DrawRect(25, 25, 100, 100)
end)

Output:

surface drawrect.png
Personal tools
Navigation