DK = DK or {} local draw = draw local surface = surface local table = table local render = render function DK.Circle( x, y, radius, seg, col ) local cir = {} draw.NoTexture() surface.SetDrawColor(col) table.insert( cir, { x = x, y = y, u = 0.5, v = 0.5 } ) for i = 0, seg do local a = math.rad( ( i / seg ) * -360 ) table.insert( cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 } ) end local a = math.rad( 0 ) -- This is needed for non absolute segment counts table.insert( cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 } ) surface.DrawPoly( cir ) end function DK.EdgedBox(x, y, width, height, move, color) surface.SetDrawColor( color.r, color.g, color.b, color.a ) draw.NoTexture() surface.DrawPoly({ { x = x, y = y+height }, { x = x+move, y = y }, { x = x+width, y = y }, { x = x+width-move, y = y+height } }) end function DK.BluredText(txt, font, x, y, col, alx, aly, blurcol, noshadow) if not noshadow then draw.SimpleText(txt, font, x+2, y+2, Color(0,0,0,col.a), alx, aly) end local x1, y1 if blurcol.a > 0 and col.a > 0 then x1, y1 = draw.SimpleText(txt, font.."_Blur", x, y, blurcol, alx, aly) end local x2, y2 = draw.SimpleText(txt, font, x, y, col, alx, aly) x1 = x1 or x2 y1 = y1 or y2 return x1, y1 end function DK.ShadowText(t, f, x, y, c, ax, ay, move) move = math.max(move, 1) local x1, y1 = draw.SimpleText(t, f, x+move, y+move, color_black, ax, ay) draw.SimpleText(t, f, x, y, c, ax, ay) return x1, y1 end local blur = Material( "pp/blurscreen" ) local function drawblur( panel, layers, density, alpha ) local x, y = panel:LocalToScreen(0, 0) surface.SetDrawColor( 255, 255, 255, alpha ) surface.SetMaterial( blur ) for i = 1, 3 do blur:SetFloat( "$blur", ( i / layers ) * density ) blur:Recompute() render.UpdateScreenEffectTexture() surface.DrawTexturedRect( -x, -y, ScrW(), ScrH() ) end end function DK.Derma(par) local frm = vgui.Create("DFrame", par) frm.Paint = function(self, w, h) drawblur( frm, 10, 20, 255 ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 150 ) ) draw.RoundedBox( 0, 0, 0, w, 25, Color( 0, 0, 0, 200 ) ) end frm.btnClose.Paint = function(self, w, h) draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 0, 0, 150 ) ) draw.SimpleText("X","DermaDefault",w/2,h/2,color_white,1,1) end frm.btnMaxim.Paint = function(self,w,h) end frm.btnMinim.Paint = function(self,w,h) end return frm end