Garry's Mod Wiki

Revision Difference

GWEN.CreateTextureBorder#511661

<function name="CreateTextureBorder" parent="GWEN" type="libraryfunc">⤶ <description>Used in derma skins to create a bordered rectangle drawing function from an image. The texture is taken either from last argument or from SKIN.GwenTexture</description>⤶ <realm>Client and Menu</realm>⤶ <args>⤶ <arg name="x" type="number">The X coordinate on the texture</arg>⤶ <arg name="y" type="number">The Y coordinate on the texture</arg>⤶ <arg name="w" type="number">Width of the area on texture</arg>⤶ <arg name="h" type="number">Height of the area on texture</arg>⤶ <arg name="left" type="number">Left width of border</arg>⤶ <arg name="top" type="number">Top width of border</arg>⤶ <arg name="right" type="number">Right width of border</arg>⤶ <arg name="bottom" type="number">Bottom width of border</arg>⤶ <arg name="source" type="IMaterial" default="nil">Texture of source image to create a bordered rectangle from. Uses SKIN.GwenTexture if not set.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="function">The drawing function. Arguments are:⤶ * <page>number</page> x - X coordinate for the box⤶ * <page>number</page> y - Y coordinate for the box⤶ * <page>number</page> w - Width of the box⤶ * <page>number</page> h - Height of the box⤶ * <page>table</page> clr - Optional color, default is white. Uses the <page>Color</page></ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Draws a bordered box in the top left corner of the screen using current skins texture.</description>⤶ <code>⤶ local paintBox = GWEN.CreateTextureBorder( 384, 32, 31, 31, 4, 4, 4, 4 )⤶ hook.Add( "HUDPaint", "PaintStuff", function()⤶ paintBox( 0, 0, 100, 100 )⤶ end )⤶ </code>⤶ <output>If using default skin, it will be a 100x100px transparent blue box in top left corner with solid blue borders.</output>⤶ ⤶ </example>