Garry's Mod Wiki

surface.DrawRect

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:

Page Links


Special Pages


Wikis

?

Render Time: 35ms

DB GetPage 5
Generate Html 8
SaveChanges (1) 13
Render Body 0
Render Sidebar 7