cl_show.lua:
[lua]
local w = ScrW() / 2
local h = ScrH() / 2
cl = {}
cl[1] = Color( 207, 213, 158, 255 )
cl[2] = Color( 42, 44, 43, 255 )
cl[3] = Color( 255, 255, 255, 255 )
cl[4] = Color( 207, 213, 158, 255 )
Frame = CreateFrame(“Main Frame”, 4, w - 200, h - 150, 400, 300, cl[1], cl[2], cl[3], cl[4], true)
Close = Btn(“Close”, Frame, 20, 20, 100, 20, Color(255,0,0,255), Color(75,75,75,255))
[/lua]
cl_init.lua:
[lua]
function CreateFrame(title, border, x, y, w, h, color, bcolor, fcolor, lcolor, drag)
local name = vgui.Create( “DFrame” )
name:SetPos( x, y )
name:SetSize( w, h )
name:SetTitle( “” )
name:SetVisible( true )
name:SetDraggable( drag )
name:ShowCloseButton( false )
name:MakePopup()
name.Paint = function()
draw.Frame(title, border, 0, 0, name:GetWide() - 6, name:GetTall() - 6, color, bcolor, fcolor, lcolor )
end
local Close = vgui.Create("DImageButton", name)
Close:SetImage("gui/silkicons/check_off")
Close:SetSize(16,16)
Close:SetPos(name:GetWide() - 25, 3)
Close.DoClick = function(btn)
name:Remove()
end
end
function Btn(text, parent, x, y, w, h, color, color2)
local Col = color
local btnName = vgui.Create( “DButton” )
btnName:SetParent( parent )
btnName:SetText( text )
btnName:SetPos( x, y )
btnName:SetSize( w, h )
btnName.Paint = function()
draw.RoundedBox(4, 0, 0, btnName:GetWide(), btnName:GetTall(), Col)
end
btnName.OnCursorEntered = function()
Col = color2;
end;
btnName.OnCursorExited = function()
Col = color;
end;
end
[/lua]
Everything is drawing on the screen, just not parenting. the button to the frame like it should