-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44062a8
commit 2cf8202
Showing
1 changed file
with
16 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |