Skip to content

Commit

Permalink
Update vgui_showlayout.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
robotboy655 committed Mar 30, 2021
1 parent 44062a8 commit 2cf8202
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions garrysmod/lua/includes/util/vgui_showlayout.lua
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
--=============================================================================--
-- ___ ___ _ _ _ __ _ ___ ___ __ __
-- |_ _|| __| / \ | \_/ | / _| / \ | o \ o \\ V /
-- | | | _| | o || \_/ | ( |_n| o || / / \ /
-- |_| |___||_n_||_| |_| \__/|_n_||_|\\_|\\ |_| 2007
--
--=============================================================================--

local Panels = {}


local function VGUIShowLayoutPaint()

hook.Add( "DrawOverlay", "VGUIShowLayoutPaint", function()

for panel, data in pairs( Panels ) do

if ( panel:IsValid() ) then

local x, y = panel:LocalToScreen( 0, 0 )

local Alpha = math.Clamp( (data.Time - SysTime()) / 0.3, 0, 1 ) * 100

surface.SetDrawColor( 255, 0, 0, Alpha )
surface.DrawRect( x, y, panel:GetWide(), panel:GetTall() )

surface.SetDrawColor( 0, 255, 0, Alpha )
surface.DrawOutlinedRect( x, y, panel:GetWide(), panel:GetTall() )


-- vgui_visualizelayout 2?
-- draw.SimpleText( panel:GetZPos(), "Default", x + 3, y, color_white )

end

if ( !panel:IsValid() || data.Time < SysTime() ) then
Panels[ panel ] = nil
end

end

end

hook.Add( "DrawOverlay", "VGUIShowLayoutPaint", VGUIShowLayoutPaint )
end

end )

-- Called from the engine
function VisualizeLayout( panel )

local tab = {}
tab.Time = SysTime() + 0.3

Panels[ panel ] = tab

end
end

0 comments on commit 2cf8202

Please sign in to comment.