Garry's Mod Wiki

surface.DrawOutlinedRect

surface.DrawOutlinedRect( number x, number y, number w, number h )

Description

Draws a hollow box with a border width of 1 px.

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 start x integer coordinate.
2 number y
The start y integer coordinate.
3 number w
The integer width.
4 number h
The integer height.

Example

Draws a 100x100 outlined rectangle in top left corner.

surface.SetDrawColor( Color( 255, 255, 255, 255 ) ) surface.DrawOutlinedRect( 0, 0, 100, 100 )

Example

A convenience function to draw an outlined rect with given color and thickness

function draw.OutlinedBox( x, y, w, h, thickness, clr ) surface.SetDrawColor( clr ) for i=0, thickness - 1 do surface.DrawOutlinedRect( x + i, y + i, w - i * 2, h - i * 2 ) end end // Usage hook.Add( "HUDPaint", "OutlinedRectExample", function() draw.OutlinedBox( 0, 0, 100, 100, 2, Color( 255, 255, 255 ) ) end )

Page Links


Special Pages


Wikis

?

Render Time: 32ms

DB GetPage 4
Generate Html 6
SaveChanges (1) 12
Render Body 0
Render Sidebar 6