mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 13:23:46 +03:00
50 lines
997 B
Lua
50 lines
997 B
Lua
--[[
|
|
| This file was obtained through the combined efforts
|
|
| of Madbluntz & Plymouth Antiquarian Society.
|
|
|
|
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
|
| Maloy, DrPepper10 @ RIP, Atle!
|
|
|
|
|
| Visit for more: https://plymouth.thetwilightzone.ru/
|
|
--]]
|
|
|
|
|
|
local PANEL = {}
|
|
|
|
AccessorFunc( PANEL, "m_Color", "Color" )
|
|
AccessorFunc( PANEL, "m_BorderColor", "BorderColor" )
|
|
AccessorFunc( PANEL, "m_Type", "Type" )
|
|
|
|
local RenderTypes = {}
|
|
|
|
function RenderTypes.Rect( pnl )
|
|
surface.SetDrawColor( pnl:GetColor() )
|
|
surface.DrawRect( 0, 0, pnl:GetSize() )
|
|
end
|
|
|
|
function PANEL:Init()
|
|
|
|
self:SetColor( color_white )
|
|
|
|
self:SetMouseInputEnabled( false )
|
|
self:SetKeyboardInputEnabled( false )
|
|
|
|
end
|
|
|
|
function PANEL:Paint()
|
|
|
|
RenderTypes[ self.m_Type ]( self )
|
|
|
|
end
|
|
|
|
derma.DefineControl( "DShape", "A shape", PANEL, "DPanel" )
|
|
|
|
-- Convenience function
|
|
function VGUIRect( x, y, w, h )
|
|
local shape = vgui.Create( "DShape" )
|
|
shape:SetType( "Rect" )
|
|
shape:SetPos( x, y )
|
|
shape:SetSize( w, h )
|
|
return shape
|
|
end
|