-- Based off Derma_DrawBackgroundBlur
local matBlurScreen = Material( "pp/blurscreen" )
function Derma_DrawBackgroundBlurInside( panel )
local x, y = panel:LocalToScreen( 0, 0 )
surface.SetMaterial( matBlurScreen )
surface.SetDrawColor( 255, 255, 255, 255 )
for i=0.33, 1, 0.33 do
matBlurScreen:SetFloat( "$blur", 5 * i ) -- Increase number 5 for more blur
matBlurScreen:Recompute()
if ( render ) then render.UpdateScreenEffectTexture() end
surface.DrawTexturedRect( x * -1, y * -1, ScrW(), ScrH() )
end
-- The line below gives the background a dark tint
surface.SetDrawColor( 10, 10, 10, 150 )
surface.DrawRect( x * -1, y * -1, ScrW(), ScrH() )
end
-- Create custom VGUI Panel
local PANEL = {}
function PANEL:Init()
self:SetSize( 450, 350 )
self:Center()
end
local mat = Material( "pp/blurscreen" )
function PANEL:Paint( w, h )
Derma_DrawBackgroundBlurInside( self )
draw.DrawText( "Blurred background", "Trebuchet24", w / 2, 12, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
end
vgui.Register( "DBlurredBackground", PANEL )
-- Create and show custom panel
vgui.Create( "DBlurredBackground" )