Garry's Mod Wiki

Garry's Mod Wiki

  surface.DrawRect( number x, number y, number width, number height )

Description

Draws a solid rectangle on the screen.

This is a rendering function that requires a 2d rendering context.

This means that it will only work in 2d Rendering Hooks.

Arguments

1 number x
The X integer co-ordinate.
2 number y
The Y integer co-ordinate.
3 number width
The integer width of the rectangle.
4 number height
The integer height of the rectangle.

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:

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...