Revision Difference
surface.SetDrawColor#512014
<function name="SetDrawColor" parent="surface" type="libraryfunc">⤶
<description>Set the color of any future shapes to be drawn, can be set by either using r, g, b, a as separate values or by a <page>Color</page>. Using a color structure is not recommended to be created procedurally.</description>⤶
<realm>Client and Menu</realm>⤶
<args>⤶
<arg name="r" type="number">The red value of color, or a <page>Color</page>.</arg>⤶
<arg name="g" type="number">The green value of color. Unused if a <page>Color</page> was given.</arg>⤶
<arg name="b" type="number">The blue value of color. Unused if a <page>Color</page> was given.</arg>⤶
<arg name="a" type="number" default="255">The alpha value of color. Unused if a <page>Color</page> was given.</arg>⤶
</args>⤶
</function>⤶
⤶
<example>⤶
<description>Draws a 512x512 textured rectangle with the wireframe material</description>⤶
<code>⤶
local ourMat = Material( "models/wireframe" ) -- Calling Material() every frame is quite expensive⤶
⤶
hook.Add( "HUDPaint", "example_hook", function()⤶
surface.SetDrawColor( 255, 0, 0, 255 ) -- Set the color to red⤶
surface.SetMaterial( ourMat ) -- If you use Material, cache it!⤶
surface.DrawTexturedRect( 0, 0, 512, 512 )⤶
end )⤶
</code>⤶
⤶
</example>