From 868e729d68b5913716bfe5ddb512f4099851e9a2 Mon Sep 17 00:00:00 2001 From: Apickx Date: Mon, 28 Dec 2015 19:18:30 -0500 Subject: Initial commit --- UsefullLuaSnippets/gradient.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 UsefullLuaSnippets/gradient.lua (limited to 'UsefullLuaSnippets/gradient.lua') diff --git a/UsefullLuaSnippets/gradient.lua b/UsefullLuaSnippets/gradient.lua new file mode 100644 index 0000000..8da0742 --- /dev/null +++ b/UsefullLuaSnippets/gradient.lua @@ -0,0 +1,26 @@ + + +local Text = surface.GetTextureID("gui/gradient") + +function DrawBoxGradient(x,y,w,h,extw,color, linecolor) + surface.SetDrawColor( color.r, color.g, color.b, color.a ) + surface.DrawRect( x, y, w, h ) + + surface.SetTexture(Text) + surface.DrawTexturedRectRotated( x-extw/2, y+h/2, extw, h, 180 ) + + surface.SetDrawColor( linecolor.r, linecolor.g, linecolor.b, linecolor.a ) + surface.DrawLine(x-extw,y-1,x+w,y-1) + surface.DrawLine(x-extw,y+h,x+w,y+h) +end + +local Text2 = surface.GetTextureID("gui/gradient_down") + +function DrawBoxGradientDown(x,y,w,h,color, gradcolor) + surface.SetDrawColor( color.r, color.g, color.b, color.a ) + surface.DrawRect( x, y, w, h ) + + surface.SetDrawColor( gradcolor.r, gradcolor.g, gradcolor.b, gradcolor.a ) + surface.SetTexture(Text2) + surface.DrawTexturedRect( x, y, w, h/2 ) +end \ No newline at end of file -- cgit v1.2.3-70-g09d2