summaryrefslogtreecommitdiff
path: root/gamemode/vgui/vgui_panelbase.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-30 14:42:09 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-30 14:42:09 -0400
commit2736f498f30220b858fc6fac23e7ddc4a597df6d (patch)
tree374ceadedb654b00e09dac321620a8320830f734 /gamemode/vgui/vgui_panelbase.lua
downloadredead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.gz
redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.bz2
redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.zip
Inital commit
Diffstat (limited to 'gamemode/vgui/vgui_panelbase.lua')
-rw-r--r--gamemode/vgui/vgui_panelbase.lua78
1 files changed, 78 insertions, 0 deletions
diff --git a/gamemode/vgui/vgui_panelbase.lua b/gamemode/vgui/vgui_panelbase.lua
new file mode 100644
index 0000000..b7a4d19
--- /dev/null
+++ b/gamemode/vgui/vgui_panelbase.lua
@@ -0,0 +1,78 @@
+local PANEL = {}
+
+function PANEL:Init()
+
+ //self:SetTitle( "" )
+ self:ChooseParent()
+
+end
+
+function PANEL:ChooseParent()
+
+end
+
+function PANEL:OnMousePressed( mc )
+
+ self.Dragging = { gui.MouseX() - self.x, gui.MouseY() - self.y }
+ self:MouseCapture( true )
+
+end
+
+function PANEL:Think()
+
+ if self.Dragging then
+
+ local x = gui.MouseX() - self.Dragging[1]
+ local y = gui.MouseY() - self.Dragging[2]
+
+ x = math.Clamp( x, 0, ScrW() - self:GetWide() )
+ y = math.Clamp( y, 0, ScrH() - self:GetTall() )
+
+ self:SetPos( x, y )
+
+ end
+
+end
+
+function PANEL:GetPadding()
+ return 1
+end
+
+function PANEL:GetDefaultTextColor()
+ return Color( 255, 255, 255, 255 )
+end
+
+function PANEL:GetTextLabelColor()
+ return Color( 255, 255, 0 )
+end
+
+function PANEL:GetTextLabelFont()
+ return "PanelText"
+end
+
+function PANEL:SetTitle( title )
+
+ self.Title = title
+
+end
+
+function PANEL:GetTitle()
+
+ return self.Title
+
+end
+
+function PANEL:Paint()
+
+ draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
+ draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 150 ) )
+
+ if self.Title then
+
+ draw.SimpleText( self.Title, "ItemDisplayFont", 5, 5, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
+
+ end
+
+end
+
+derma.DefineControl( "PanelBase", "A HUD Base Element", PANEL, "DPanel" )