Garry's Mod Wiki

GWEN.CreateTextureNormal

  function GWEN.CreateTextureNormal( number x, number y, number w, number h, IMaterial mat_override = null )

Description

Used in derma skins to create a rectangle drawing function from an image. The texture of the rectangle will be scaled. The texture is taken from SKIN.GwenTexture when mat_override is not supplied

Arguments

1 number x
The X coordinate on the texture
2 number y
The Y coordinate on the texture
3 number w
Width of the area on texture
4 number h
Height of the area on texture
5 IMaterial mat_override = null
Optional. Sets the material this function will use

Returns

1 function
The drawing function. Arguments are:
  • number x - X coordinate for the box
  • number y - Y coordinate for the box
  • number w - Width of the box
  • number h - Height of the box
  • table clr - Optional color, default is white. Uses the Color

Example

Draws a huge checked checkbox in the top left corner of the screen using current skins texture.

local paintBox = GWEN.CreateTextureNormal( 448, 32, 15, 15 ) hook.Add( "HUDPaint", "PaintStuff", function() paintBox( 0, 0, 100, 100 ) end )
Output: If using default skin, it will be a 100x100px checked checkbox in top left corner of the screen.