summaryrefslogtreecommitdiff
path: root/gamemode/cl_hud
diff options
context:
space:
mode:
authorApickx <Apickx@cogarr.org>2015-12-28 19:18:30 -0500
committerApickx <Apickx@cogarr.org>2015-12-28 19:18:30 -0500
commit868e729d68b5913716bfe5ddb512f4099851e9a2 (patch)
tree6441108754145dfd68a6e23bea382b5cb1ab63d5 /gamemode/cl_hud
downloadgearfox-master.tar.gz
gearfox-master.tar.bz2
gearfox-master.zip
Initial commitHEADmaster
Diffstat (limited to 'gamemode/cl_hud')
-rw-r--r--gamemode/cl_hud/draw.lua9
-rw-r--r--gamemode/cl_hud/draw_battery.lua10
-rw-r--r--gamemode/cl_hud/draw_blockhud.lua9
-rw-r--r--gamemode/cl_hud/draw_chatbox.lua136
-rw-r--r--gamemode/cl_hud/draw_functions.lua53
-rw-r--r--gamemode/cl_hud/draw_healthbox.lua10
-rw-r--r--gamemode/cl_hud/draw_nametag.lua30
-rw-r--r--gamemode/cl_hud/draw_pickup.lua4
-rw-r--r--gamemode/cl_hud/draw_playercircle.lua1
-rw-r--r--gamemode/cl_hud/draw_scoreboard.lua35
-rw-r--r--gamemode/cl_hud/draw_voicechat.lua42
-rw-r--r--gamemode/cl_hud/vgui/mbbrowser.lua43
-rw-r--r--gamemode/cl_hud/vgui/mbbutton.lua66
-rw-r--r--gamemode/cl_hud/vgui/mbframe.lua84
-rw-r--r--gamemode/cl_hud/vgui/mblabel.lua108
-rw-r--r--gamemode/cl_hud/vgui/mbmodel.lua53
-rw-r--r--gamemode/cl_hud/vgui/mbpanellist.lua67
-rw-r--r--gamemode/cl_hud/vgui/mbtab.lua106
-rw-r--r--gamemode/cl_hud/vgui/mbtree.lua92
-rw-r--r--gamemode/cl_hud/vgui/mbuserbrowser.lua76
20 files changed, 1034 insertions, 0 deletions
diff --git a/gamemode/cl_hud/draw.lua b/gamemode/cl_hud/draw.lua
new file mode 100644
index 0000000..86faaf6
--- /dev/null
+++ b/gamemode/cl_hud/draw.lua
@@ -0,0 +1,9 @@
+
+function GM:HUDPaint()
+ DrawRect( 0, 0, ScrW(), 20, MAIN_COLOR )
+ DrawText( GM.Name, "Trebuchet18", 5, 0, MAIN_TEXTCOLOR )
+
+ DrawHealthbar()
+ DrawBatteryLife()
+end
+
diff --git a/gamemode/cl_hud/draw_battery.lua b/gamemode/cl_hud/draw_battery.lua
new file mode 100644
index 0000000..b2ba854
--- /dev/null
+++ b/gamemode/cl_hud/draw_battery.lua
@@ -0,0 +1,10 @@
+local X = ScrW()-104
+
+function DrawBatteryLife()
+ local W = system.BatteryPower()
+ if (W > 100) then return end
+
+ DrawRect(X,4,100,12,MAIN_BLACKCOLOR)
+ DrawRect(X,4,math.Clamp(W,0,100),12,MAIN_GREENCOLOR)
+ DrawText("Battery: "..W.."%","Trebuchet18",X-5,2,MAIN_TEXTCOLOR,2)
+end \ No newline at end of file
diff --git a/gamemode/cl_hud/draw_blockhud.lua b/gamemode/cl_hud/draw_blockhud.lua
new file mode 100644
index 0000000..9aa4994
--- /dev/null
+++ b/gamemode/cl_hud/draw_blockhud.lua
@@ -0,0 +1,9 @@
+local Blocks = {}
+
+function GM:AddBlockCHud(Str)
+ if (!table.HasValue(Blocks,Str)) then table.insert(Blocks,Str) end
+end
+
+hook.Add( "HUDShouldDraw", "ShouldDraw", function( name )
+ if (table.HasValue(Blocks,name)) then return false end
+end) \ No newline at end of file
diff --git a/gamemode/cl_hud/draw_chatbox.lua b/gamemode/cl_hud/draw_chatbox.lua
new file mode 100644
index 0000000..07e9d26
--- /dev/null
+++ b/gamemode/cl_hud/draw_chatbox.lua
@@ -0,0 +1,136 @@
+local MChatTab = {}
+local TextCol = Color(255,255,255,255)
+local TextCol2 = Color(200,50,50,255)
+local TextCol3 = Color(160,200,240,255)
+local x = 20
+local y = ScrH() - 300
+local d = {}
+CHAT_PAN = nil
+
+hook.Add("Initialize","ChatboxSpawn",function()
+ CHAT_PAN = vgui.Create("MBFrame")
+ CHAT_PAN:SetPos(x,y)
+ CHAT_PAN:SetSize(400,200)
+ CHAT_PAN:SetTitle("ChatBawx")
+ CHAT_PAN:SetVisible(false)
+ CHAT_PAN:ShowCloseButton(false)
+
+ CHAT_TEXT = vgui.Create("MBPanelList")
+ CHAT_TEXT:SetPos( x+5,y+25 )
+ CHAT_TEXT:SetSize( 390, 150 )
+ CHAT_TEXT:SetSpacing( 1 )
+ CHAT_TEXT:EnableHorizontal( false )
+ CHAT_TEXT:EnableVerticalScrollbar( true )
+ CHAT_TEXT:SetLimit(30)
+ CHAT_TEXT:SetMouseInputEnabled(false)
+
+ CHAT_PAN.Typer = vgui.Create("DTextEntry",CHAT_PAN)
+ CHAT_PAN.Typer:SetPos(5,175)
+ CHAT_PAN.Typer:SetSize(370,20)
+ CHAT_PAN.Typer:SetText("Say: ")
+end)
+
+function GM:SetEnableMawChat(bool)
+ self.UseMawChat = bool
+
+ if (!bool) then CHAT_PAN:SetVisible(false) CHAT_TEXT:SetVisible(false)
+ else CHAT_TEXT:SetVisible(true) end
+end
+
+function GM:StartChat()
+ if (!self.UseMawChat) then return false end
+ if (!CHAT_PAN) then return end
+
+ CHAT_TEXT:SetMouseInputEnabled(true)
+ CHAT_PAN:SetVisible(true)
+ return true
+end
+
+function GM:FinishChat()
+ if (!self.UseMawChat) then return end
+ if (!CHAT_PAN) then return end
+
+ CHAT_TEXT:SetMouseInputEnabled(false)
+ CHAT_PAN:SetVisible(false)
+end
+
+function GM:ChatTextChanged(text)
+ if (!self.UseMawChat) then return end
+ if (!CHAT_PAN) then return end
+
+ CHAT_PAN.Typer:SetText("Say: "..text)
+end
+
+function IsChatOpen()
+ return (CHAT_PAN and CHAT_PAN:IsVisible())
+end
+
+local function GenerateText(tab)
+ if (type(tab):lower() != "table") then return end
+
+ local a = vgui.Create("MBLabel")
+ a:SetSize(CHAT_TEXT:GetWide()-5,1)
+
+ for k,v in pairs(tab) do a:AddText(v[1],v[2],v[3]) end
+
+ a:SetupLines() --You need to call this AFTER adding the text...
+
+ CHAT_TEXT:AddItem(a)
+ CHAT_TEXT:InvalidateLayout(true)
+ CHAT_TEXT:AddVScroll(40)
+end
+
+function GM:OnPlayerChat( pl , text , teamtext , dead )
+ if (!self.UseMawChat) then return end
+ if (!IsValid(pl)) then return end --This function is now getting called when console talks.. odd...
+
+ local dat = {
+ {
+ "",
+ "MBChatFont_Tag",
+ MAIN_GREENCOLOR,
+ },
+ {
+ pl:Nick()..": ",
+ "MBChatFont",
+ MAIN_YELLOWCOLOR,
+ },
+ {
+ text,
+ "MBChatFont",
+ TextCol,
+ },
+ }
+
+ if (text:lower() == ":awesome:") then pl.FaceTime = CurTime()+20 end
+ if (text:lower() == "/clearchat" and pl == LocalPlayer()) then CHAT_TEXT:Clear(true) CHAT_TEXT:InvalidateLayout() return end
+
+ if (teamtext) then dat[1][1] = "(Team)"
+ elseif (dead) then dat[1][1] = "(Dead)" dat[1][3] = TextCol2
+ elseif (pl:IsAdmin()) then dat[1][1] = "(Admin)" dat[1][3] = TextCol2
+ else table.remove(dat,1) end
+
+ chat.AddText(MAIN_YELLOWCOLOR,pl:Nick()..": ",TextCol,text)
+ GenerateText(dat)
+end
+
+function GM:ChatText( int , name , text )
+ if (!self.UseMawChat) then return end
+ if (int == 0) then
+ local dat = {
+ {
+ "God: ",
+ "MBChatFont",
+ TextCol3,
+ },
+ {
+ text,
+ "MBChatFont",
+ TextCol,
+ },
+ }
+
+ chat.AddText(MAIN_COLOR,"Game: ",TextCol,text)
+ GenerateText(dat)
+ end
+end \ No newline at end of file
diff --git a/gamemode/cl_hud/draw_functions.lua b/gamemode/cl_hud/draw_functions.lua
new file mode 100644
index 0000000..6ad625d
--- /dev/null
+++ b/gamemode/cl_hud/draw_functions.lua
@@ -0,0 +1,53 @@
+
+local Grad = surface.GetTextureID("gui/gradient")
+
+function DrawBoxy(x,y,w,h,color)
+ draw.RoundedBox( 8, x, y, w, h, color )
+end
+
+function DrawText(text,font,x,y,color,bCentered)
+ draw.SimpleText( text, font, x, y, color, bCentered or 0, bCentered or 0 )
+end
+
+function DrawRect(x,y,w,h,color)
+ surface.SetDrawColor( color.r, color.g, color.b, color.a )
+ surface.DrawRect( x, y, w, h )
+end
+
+function DrawOutlinedRect(x,y,w,h,color)
+ surface.SetDrawColor( color.r, color.g, color.b, color.a )
+ surface.DrawOutlinedRect( x, y, w, h )
+end
+
+function DrawLeftGradient(x,y,w,h,color)
+ DrawTexturedRect(x,y,w,h,color,Grad)
+end
+
+function DrawTexturedRect(x,y,w,h,color,texture)
+ surface.SetTexture( texture )
+ surface.SetDrawColor( color.r, color.g, color.b, color.a )
+ surface.DrawTexturedRect( x, y, w, h )
+end
+
+function DrawTexturedRectRotated(x,y,w,h,color,texture,rot)
+ surface.SetTexture( texture )
+ surface.SetDrawColor( color.r, color.g, color.b, color.a )
+ surface.DrawTexturedRectRotated( x, y, w, h, rot )
+end
+
+function DrawMaterialRect(x,y,w,h,color,material)
+ surface.SetMaterial( material )
+ surface.SetDrawColor( color.r, color.g, color.b, color.a )
+ surface.DrawTexturedRect( x, y, w, h )
+end
+
+function DrawMaterialRectRotated(x,y,w,h,color,material,rot)
+ surface.SetMaterial( material )
+ surface.SetDrawColor( color.r, color.g, color.b, color.a )
+ surface.DrawTexturedRectRotated( x, y, w, h, rot )
+end
+
+function DrawLine(x,y,x2,y2,color)
+ surface.SetDrawColor( color.r, color.g, color.b, color.a )
+ surface.DrawLine( x, y, x2, y2 )
+end \ No newline at end of file
diff --git a/gamemode/cl_hud/draw_healthbox.lua b/gamemode/cl_hud/draw_healthbox.lua
new file mode 100644
index 0000000..0801181
--- /dev/null
+++ b/gamemode/cl_hud/draw_healthbox.lua
@@ -0,0 +1,10 @@
+function DrawHealthbar()
+ local HP = LocalPlayer():Health()
+ local MP = 100 --player:GetMaxHealth() apparently doesn't work quite well on Clients...
+ local C = math.Clamp(HP/MP,0,1)
+
+ DrawBoxy( 10, ScrH()-60, 200, 50, MAIN_COLOR )
+ DrawRect( 20, ScrH()-50, 180, 30, MAIN_BLACKCOLOR )
+ DrawRect( 20, ScrH()-50, 180*C, 30, MAIN_GREENCOLOR )
+ DrawText( HP.."/"..MP, "Trebuchet24", 110, ScrH()-35, MAIN_TEXTCOLOR, 1 )
+end \ No newline at end of file
diff --git a/gamemode/cl_hud/draw_nametag.lua b/gamemode/cl_hud/draw_nametag.lua
new file mode 100644
index 0000000..a15b69f
--- /dev/null
+++ b/gamemode/cl_hud/draw_nametag.lua
@@ -0,0 +1,30 @@
+
+local UpVec = Vector(0,0,80)
+local C = MAIN_TEXTCOLOR
+local EnaTa = true
+
+function GM:SetEnableMawNameTag(bool)
+ EnaTa = bool
+end
+
+hook.Add("HUDPaint","DrawingNames",function()
+ if (!EnaTa) then hook.Remove("HUDPaint","DrawingNames") return end
+
+ for k,pl in pairs( player.GetAll() ) do
+ if (LocalPlayer() != pl) then
+ local Dis = pl:GetPos():Distance(LocalPlayer():GetPos())
+
+ if (Dis < 800) then
+ local spos = (pl:GetPos()+UpVec):ToScreen()
+ local Alpha = math.Clamp(Dis/800,0,1)
+ local A = C.a*1
+
+ C.a = A-A*Alpha
+
+ DrawText( pl:Nick(), "MBPlayerNameFont", spos.x, spos.y, C, 1 )
+
+ C.a = A
+ end
+ end
+ end
+end) \ No newline at end of file
diff --git a/gamemode/cl_hud/draw_pickup.lua b/gamemode/cl_hud/draw_pickup.lua
new file mode 100644
index 0000000..ec2a96e
--- /dev/null
+++ b/gamemode/cl_hud/draw_pickup.lua
@@ -0,0 +1,4 @@
+
+
+function GM:HUDWeaponPickedUp( W )
+end \ No newline at end of file
diff --git a/gamemode/cl_hud/draw_playercircle.lua b/gamemode/cl_hud/draw_playercircle.lua
new file mode 100644
index 0000000..68498aa
--- /dev/null
+++ b/gamemode/cl_hud/draw_playercircle.lua
@@ -0,0 +1 @@
+local CIRCLE = surface.GetTextureID("SGM/playercircle") local CIROFF = Vector(0,0,1) local CIROF2 = Vector(0,0,10) local CIRDOW = Vector(0,0,150) local CIRANG = Angle(0,0,0) local CIRENA = true local CIRCOL = MAIN_COLOR function GM:SetEnableMawCircle(bool) CIRENA = bool end function GM:SetMawCircleTexture(TexID) CIRCLE = TexID end function GM:SetMawCircleColor(Col) CIRCOL = Col end hook.Add("PostPlayerDraw","DrawingPlayerCircle",function(pl) if (!CIRENA) then return end local p = pl:GetPos() local t = { start = p+CIROF2, endpos = p-CIRDOW, filter = pl, mask = MASK_SOLID_BRUSHONLY, } t = util.TraceLine(t) local B = CIRCOL.a*1 CIRCOL.a = math.Clamp(140-p:Distance(t.HitPos),0,250) if (t.Hit) then cam.Start3D2D(t.HitPos+CIROFF,CIRANG,0.2) DrawTexturedRect( -100, -100, 200, 200, CIRCOL, CIRCLE) cam.End3D2D() end CIRCOL.a = B end) \ No newline at end of file
diff --git a/gamemode/cl_hud/draw_scoreboard.lua b/gamemode/cl_hud/draw_scoreboard.lua
new file mode 100644
index 0000000..1d1da16
--- /dev/null
+++ b/gamemode/cl_hud/draw_scoreboard.lua
@@ -0,0 +1,35 @@
+local SCOREBOARD_FADE = Color(20,20,20,70)
+
+local SCOREBOARD_OFF = 101
+local SCOREBOARD_WIDTH = 700
+local SCOREBOARD_X = ScrW() / 2 - SCOREBOARD_WIDTH / 2
+
+function GM:ScoreboardShow()
+ self.ShowSB = true
+end
+
+function GM:ScoreboardHide()
+ self.ShowSB = false
+end
+
+function GM:HUDDrawScoreBoard()
+ if (!self.ShowSB) then return end
+
+ local NPly = #player.GetAll()
+ local Tall = SCOREBOARD_OFF + 20 * NPly + 20
+ local y = ScrH() / 2 - Tall / 2
+ local by = y + SCOREBOARD_OFF
+
+ DrawBoxy(SCOREBOARD_X, y, SCOREBOARD_WIDTH, Tall, MAIN_COLOR)
+ DrawRect(SCOREBOARD_X, by, SCOREBOARD_WIDTH, NPly*20, MAIN_COLORD)
+
+ DrawText(self.Name, "ScoreboardFont", SCOREBOARD_X + 20, y + 20, MAIN_TEXTCOLOR)
+
+ for k,v in pairs( player.GetAll() ) do
+ local Y = by + 20 * (k-1)
+
+ DrawText(v:Nick(), "Trebuchet18", SCOREBOARD_X + 2, Y, MAIN_TEXTCOLOR)
+ DrawText(v:Ping(), "Trebuchet18", SCOREBOARD_X + SCOREBOARD_WIDTH - 30, Y, MAIN_TEXTCOLOR)
+ end
+end
+
diff --git a/gamemode/cl_hud/draw_voicechat.lua b/gamemode/cl_hud/draw_voicechat.lua
new file mode 100644
index 0000000..b087eb9
--- /dev/null
+++ b/gamemode/cl_hud/draw_voicechat.lua
@@ -0,0 +1,42 @@
+local VoiceMat = surface.GetTextureID("voice/speaker4")
+local VoiceEna = true
+local VOCOL = table.Copy(MAIN_COLOR)
+
+function GM:PlayerStartVoice( ply )
+ if (!VoiceEna) then self.BaseClass:PlayerStartVoice( ply ) return end
+ ply.Talking = true
+end
+
+function GM:PlayerEndVoice( ply )
+ if (!VoiceEna) then self.BaseClass:PlayerEndVoice( ply ) return end
+ ply.Talking = nil
+end
+
+function GM:SetEnableMawVoiceHUD(bool)
+ VoiceEna = bool
+end
+
+hook.Add("HUDPaint","_VoiceChatDraw",function()
+ if (!VoiceEna) then return end
+
+ local D = 0
+
+ for k,v in pairs( player.GetAll() ) do
+ if (v.Talking) then
+ local H = 30 + 30*D
+ D = D+1
+
+ local V = v:VoiceVolume()
+ local D = MAIN_COLOR
+
+ VOCOL.r = math.Clamp(D.r-100*V,0,255)
+ VOCOL.g = math.Clamp(D.g+200*V,0,255)
+ VOCOL.b = math.Clamp(D.b-100*V,0,255)
+
+ DrawRect( 0, H, 200, 25, VOCOL )
+
+ DrawTexturedRect( 180, H+4, 16, 16, MAIN_TEXTCOLOR, VoiceMat )
+ DrawText( v:Nick(), "Trebuchet18", 4, H+3, MAIN_TEXTCOLOR )
+ end
+ end
+end) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mbbrowser.lua b/gamemode/cl_hud/vgui/mbbrowser.lua
new file mode 100644
index 0000000..738c8ed
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mbbrowser.lua
@@ -0,0 +1,43 @@
+local PANEL = {}
+
+function PANEL:Init()
+ self.bgcol = MAIN_COLOR
+ self.fgcol = MAIN_COLOR2
+
+ self.HTML = vgui.Create( "HTML" , self )
+ self.HTML:OpenURL("www.google.com")
+ self.HTML.StatusChanged = function( s , str ) self.Status = str end
+
+ self.Status = "Ready."
+
+ self:SetPaintBackgroundEnabled( false )
+ self:SetPaintBorderEnabled( false )
+end
+
+function PANEL:OpenURL(url)
+ self.HTML:OpenURL(url)
+end
+
+function PANEL:SetFGColor( col )
+ self.fgcol = col
+end
+
+function PANEL:SetBGColor( col )
+ self.bgcol = col
+end
+
+function PANEL:Paint(w,h)
+ DrawBoxy( 0 , 0 , w , h , self.bgcol )
+ DrawLine( 0 , 20 , w , 20 , self.fgcol )
+
+ DrawText( self.Status , "Trebuchet18" , 5 , self:GetTall()-20 , MAIN_WHITECOLOR )
+
+ return true
+end
+
+function PANEL:PerformLayout()
+ self.HTML:SetPos(1,22)
+ self.HTML:SetSize(self:GetWide()-2,self:GetTall()-44)
+end
+
+vgui.Register( "MBBrowser", PANEL , "MBFrame" ) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mbbutton.lua b/gamemode/cl_hud/vgui/mbbutton.lua
new file mode 100644
index 0000000..a5c0363
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mbbutton.lua
@@ -0,0 +1,66 @@
+local PANEL = {}
+
+function PANEL:Init()
+ self.Hover = false
+ self.Pressed = false
+ self.Text = "No-Title Button"
+ self.ClickSound = "buttons/lightswitch2.wav"
+ self.ClickEnable = true
+
+ self.HoverSound = "common/bugreporter_succeeded.wav"
+ self.HoverEnable = false
+
+
+ self:SetText("")
+ self.SetText = function(s,txt) self.Text = txt end
+end
+
+function PANEL:OnCursorEntered()
+ self.Hover = true
+ if (self.HoverEnable) then surface.PlaySound(self.HoverSound) end
+end
+
+function PANEL:EnableHoverSound(bool)
+ self.HoverEnable = bool
+end
+
+function PANEL:SetHoverSound(sound)
+ self.HoverSound = sound
+end
+
+function PANEL:EnableClickSound(bool)
+ self.ClickEnable = bool
+end
+
+function PANEL:SetClickSound(sound)
+ self.ClickSound = sound
+end
+
+function PANEL:OnMousePressed()
+ self.Pressed = true
+ self:MouseCapture( true )
+end
+
+function PANEL:OnMouseReleased()
+ if (self.Pressed) then surface.PlaySound(self.ClickSound) self:DoClick() end
+
+ self.Pressed = false
+ self:MouseCapture( false )
+end
+
+function PANEL:OnCursorExited()
+ self.Hover = false
+end
+
+function PANEL:Paint(w,h)
+ if (self.Pressed) then DrawRect( 0 , 0 , w , h , MAIN_GREENCOLOR )
+ elseif (self.Hover) then DrawRect( 0 , 0 , w , h , MAIN_COLOR2 )
+ else DrawRect( 0 , 0 , w , h , MAIN_COLORD ) end
+
+ DrawText( self.Text, "Trebuchet18", w/2, h/2, MAIN_TEXTCOLOR, 1 )
+end
+
+function PANEL:PerformLayout()
+end
+
+vgui.Register( "MBButton", PANEL , "Button" ) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mbframe.lua b/gamemode/cl_hud/vgui/mbframe.lua
new file mode 100644
index 0000000..ab99fd7
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mbframe.lua
@@ -0,0 +1,84 @@
+local PANEL = {}
+local Close = surface.GetTextureID("gearfox/vgui/close")
+
+function PANEL:Init()
+ self.bgcol = MAIN_COLOR
+ self.fgcol = MAIN_COLOR2
+
+ self.Font = "Trebuchet18"
+ self.Text = "No-Title MBFrame"
+ self.TextCol = MAIN_TEXTCOLOR
+ self.BrigCol = MAIN_WHITECOLOR
+ self.CloseRem = false
+ self.ShowClose = true
+
+ self:SetPaintBackgroundEnabled( false )
+ self:SetPaintBorderEnabled( false )
+end
+
+function PANEL:OnClose()
+end
+
+function PANEL:SetDeleteOnClose( bool )
+ self.CloseRem = bool
+end
+
+function PANEL:SetTitle( name )
+ self.Text = name
+end
+
+function PANEL:SetFGColor( col )
+ self.fgcol = col
+end
+
+function PANEL:SetBGColor( col )
+ self.bgcol = col
+end
+
+function PANEL:SetTextColor( col )
+ self.TextCol = col
+end
+
+function PANEL:SetTextFont( font )
+ self.Font = font
+end
+
+function PANEL:ShowCloseButton( bool )
+ self.ShowClose = bool
+end
+
+function PANEL:OnMousePressed()
+ if (!self.ShowClose) then return end
+
+ local x,y = self:LocalToScreen( self:GetWide()-17 , 3 )
+
+ if (input.IsMouseInBox( x , y , 14 , 14 )) then
+ self:OnClose()
+
+ if (self.CloseRem) then self:Remove()
+ else self:SetVisible(false) end
+ end
+end
+
+function PANEL:Paint(w,h)
+ DrawBoxy( 0 , 0 , w , h , self.bgcol )
+ DrawLine( 0 , 20 , w , 20 , self.fgcol )
+end
+
+function PANEL:PaintOver(w,h)
+ DrawText( self.Text , self.Font , 2 , 2 , self.TextCol )
+
+ if (self.ShowClose) then
+ local x,y = self:GetPos()
+
+ if (input.IsMouseInBox(x+w-17 , y+3 , 14 , 14)) then DrawTexturedRect( w-17 , 3 , 14 , 14 , self.BrigCol , Close )
+ else DrawTexturedRect( w-17 , 3 , 14 , 14 , self.TextCol , Close ) end
+ end
+
+ return true
+end
+
+function PANEL:PerformLayout()
+end
+
+vgui.Register( "MBFrame", PANEL, "EditablePanel" ) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mblabel.lua b/gamemode/cl_hud/vgui/mblabel.lua
new file mode 100644
index 0000000..1f1e3bb
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mblabel.lua
@@ -0,0 +1,108 @@
+local PANEL = {}
+
+function PANEL:Init()
+ self.Lines = {}
+ self.Texts = {}
+
+ self.LineHeight = 20
+end
+
+function PANEL:AddText(text,font,color)
+ if (!font) then font = "Trebuchet18" end
+ if (!color) then color = MAIN_TEXTCOLOR end
+
+ text = " "..text
+
+ table.insert(self.Texts,{text,font,color,})
+end
+
+function PANEL:ClearText()
+ self.Lines = {}
+ self.Texts = {}
+end
+
+function PANEL:SetupLines()
+ local w = 0
+ local dat = {}
+ local Tal = 20
+
+ for k,v in pairs( self.Texts ) do
+ surface.SetFont(v[2])
+ local a,b = surface.GetTextSize(v[1])
+
+ if (b > Tal) then Tal = b end
+
+ if (w+a > self:GetWide()) then
+ local Exp = string.Explode(" ",v[1])
+ local Dat = ""
+ local Tab = {}
+ local wi = 0
+
+ for p,d in pairs( Exp ) do
+ local si,so = surface.GetTextSize(" "..d)
+
+ wi = wi + si
+
+ if (w+wi < self:GetWide()) then
+ Dat = Dat.." "..d
+ else
+ table.insert(dat,{Dat,v[2],v[3],})
+ table.insert(self.Lines,dat)
+
+ dat = {}
+ Dat = " "..d
+ wi = 0
+ w = 0
+ end
+ end
+
+ table.insert(dat,{Dat,v[2],v[3],})
+ else
+ w = w + a
+ table.insert(dat,v)
+ end
+ end
+
+ table.insert(self.Lines,dat)
+
+ Tal = Tal*#self.Lines
+ self:SetTall(Tal)
+
+ self.Texts = nil --Since this function is called to setup a wrapped text, we no longer need the table with shit on.
+end
+
+function PANEL:SetTextColor( col )
+end
+
+function PANEL:SetTextFont( font )
+end
+
+function PANEL:Paint()
+ if (self.Lines) then
+ for k,v in pairs(self.Lines) do
+ local w = 0
+ for c,j in pairs(v) do
+ local Text = j[1]
+ local Font = j[2]
+ local Col = j[3]
+
+ surface.SetFont(Font)
+
+ local wid,hei = surface.GetTextSize(Text)
+
+ surface.SetTextColor(Col)
+ surface.SetTextPos(w,self.LineHeight*(k-1))
+ surface.DrawText(Text)
+
+ w = w+wid
+ end
+ end
+ end
+
+ return true
+end
+
+function PANEL:PerformLayout()
+end
+
+vgui.Register( "MBLabel", PANEL , "DLabel" ) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mbmodel.lua b/gamemode/cl_hud/vgui/mbmodel.lua
new file mode 100644
index 0000000..373c98a
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mbmodel.lua
@@ -0,0 +1,53 @@
+local PANEL = {}
+local Zero = Vector(0,0,0)
+local One = Vector(1,1,1)
+
+function PANEL:Init()
+ self.bgcol = MAIN_COLOR2
+
+ self.Model = vgui.Create( "DModelPanel" , self )
+ self.Model:SetCamPos( Vector( 30, 30, 30 ) )
+ self.Model:SetLookAt( Zero )
+ self.Model:SetSize( self:GetWide() , self:GetTall() )
+ self.Model:SetPos( 0 , 0 )
+
+ self.Model.DoRightClick = function(s) self:DoRightClick() end
+ self.Model.DoClick = function(s) self:DoLeftClick() end
+end
+
+function PANEL:DoRightClick()
+end
+
+function PANEL:DoLeftClick()
+end
+
+function PANEL:SetModel( name , Texture )
+ self.Model:SetModel( name )
+
+ local MSize,SSize = self.Model.Entity:GetRenderBounds()
+ SSize = SSize:Length()
+
+ self.Model:SetCamPos( One * SSize )
+ self.Model:SetLookAt( Zero )
+
+ if (Texture) then self.Model.Entity:SetMaterial(Texture) end
+end
+
+function PANEL:GetModel()
+ return self.Model.Entity:GetModel()
+end
+
+function PANEL:SetBGColor( col )
+ self.bgcol = col
+end
+
+function PANEL:Paint(w,h)
+ DrawRect( 0 , 0 , w , h , self.bgcol )
+end
+
+function PANEL:PerformLayout()
+ self.Model:SetSize( self:GetWide() , self:GetTall() )
+ self.Model:SetPos( 0 , 0 )
+end
+
+vgui.Register( "MBModel", PANEL , "Panel" ) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mbpanellist.lua b/gamemode/cl_hud/vgui/mbpanellist.lua
new file mode 100644
index 0000000..3e9666a
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mbpanellist.lua
@@ -0,0 +1,67 @@
+local PANEL = {}
+
+function PANEL:Init()
+ self.bgcol = MAIN_COLORD
+ self.Limit = 100
+
+ self:SetPadding( 1 )
+ self:SetSpacing( 1 )
+ self:SetAutoSize(false)
+ self:EnableHorizontal( false )
+ self:EnableVerticalScrollbar( true )
+ self.VBar.Paint = function(s) end
+ self.VBar.btnGrip.Paint = function(s,w,h) DrawRect( 2 , 0 , w-4 , h , self.bgcol ) end
+ self.VBar.btnDown.Paint = function(s,w,h) DrawRect( 2 , 2 , w-4 , h-4 , self.bgcol ) end
+ self.VBar.btnUp.Paint = function(s,w,h) DrawRect( 2 , 2 , w-4 , h-4 , self.bgcol ) end
+
+ self.Delta = 0
+ self.Smooth = 0
+end
+
+function PANEL:OnMouseWheeled(Delta)
+ self.Delta = self.Delta+Delta
+end
+
+function PANEL:SetVScroll(num)
+ self.VBar:SetScroll(num)
+end
+
+function PANEL:AddVScroll(num)
+ self.VBar:AddScroll(num)
+end
+
+function PANEL:SetFGColor( col )
+ self.fgcol = col
+end
+
+function PANEL:SetLimit(l)
+ self.Limit = l
+end
+
+function PANEL:RemoveItem( item )
+ for k, v in pairs( self.Items ) do
+ if ( v == item ) then
+ table.remove(self.Items,k)
+ v:Remove()
+
+ self:InvalidateLayout()
+ break
+ end
+ end
+end
+
+function PANEL:Think()
+ local It = self:GetItems()
+ if (#It > self.Limit) then self:RemoveItem(It[#It-self.Limit]) end
+
+ if (self.Delta > 0.01 or self.Delta < -0.01 or self.Smooth > 0.01 or self.Smooth < -0.01) then
+ self.Delta = self.Delta - self.Delta/8
+ self.Smooth = self.Smooth + (self.Delta-self.Smooth)/32
+ self:AddVScroll(-self.Smooth/2)
+ end
+end
+
+function PANEL:Paint()
+end
+
+vgui.Register( "MBPanelList", PANEL , "DPanelList" ) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mbtab.lua b/gamemode/cl_hud/vgui/mbtab.lua
new file mode 100644
index 0000000..3899f69
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mbtab.lua
@@ -0,0 +1,106 @@
+local PANEL = {}
+
+function PANEL:Init()
+ self.bgcol = MAIN_COLOR
+ self.fgcol = MAIN_COLOR2
+
+ self.TabsBut = {}
+ self.Tabs = {}
+ self.TabSel = ""
+ self.VertTabs = false
+
+ self.Slide = 0
+end
+
+function PANEL:OnClose()
+end
+
+function PANEL:SetVerticalTabs( bool )
+ self.VertTabs = bool
+end
+
+function PANEL:SetTitle( name )
+end
+
+function PANEL:SetFGColor( col )
+ self.fgcol = col
+end
+
+function PANEL:SetBGColor( col )
+ self.bgcol = col
+end
+
+function PANEL:AddTab(Text)
+ local A = vgui.Create("MBFrame",self)
+ A:SetTitle("")
+ A:SetVisible(false)
+ A:ShowCloseButton(false)
+ A:SetPos(0,20)
+ A:SetSize(self:GetWide(),self:GetTall()-25)
+ A.Paint = function(s,w,h) DrawRect(0,0,w,h,self.bgcol) end
+
+ local D = vgui.Create("MBButton",self)
+ D:SetText(Text)
+ D.T = #self.TabsBut*1
+
+ if (D.T < 1) then A:SetVisible(true) self.TabSel = D.T end
+
+ D.Paint = function(s,w,h)
+ if (self.TabSel == s.T) then DrawRect(0,0,w,h,self.bgcol)
+ else DrawRect(0,0,w,h,self.fgcol) end
+
+ DrawText( s.Text, "Trebuchet18", w/2, h/2, MAIN_TEXTCOLOR, 1 )
+ end
+
+ D.DoClick = function()
+ for k,v in pairs(self.Tabs) do
+ v:SetVisible(false)
+ end
+
+ self.Tabs[D.T]:SetVisible(true)
+ self.TabSel = D.T
+ end
+
+ table.insert(self.TabsBut,D)
+ self.Tabs[D.T] = A
+
+ return self.Tabs[D.T]
+end
+
+
+function PANEL:Paint()
+ return true
+end
+
+function PANEL:Think()
+ local Num = #self.TabsBut
+ local W = self:GetWide()
+ local SW = 100*Num
+ local X,Y = self:LocalToScreen()
+
+ if (SW > self:GetWide()) then
+ if (input.IsMouseInBox(X,Y,20,20) and self.Slide > 0) then
+ self.Slide = self.Slide-1
+
+ self:PerformLayout()
+ elseif (input.IsMouseInBox(X+W-20,Y,20,20) and self.Slide < SW-W) then
+ self.Slide = self.Slide+1
+
+ self:PerformLayout()
+ end
+ end
+end
+
+function PANEL:PerformLayout()
+ for k,v in pairs(self.TabsBut) do
+ v:SetPos(100*(k-1)-self.Slide,0)
+ v:SetSize(97,20)
+ end
+
+ if (self.Tabs[self.TabSel]) then
+ self.Tabs[self.TabSel]:SetPos(0,20)
+ self.Tabs[self.TabSel]:SetSize(self:GetWide(),self:GetTall()-25)
+ end
+end
+
+vgui.Register( "MBTab", PANEL ) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mbtree.lua b/gamemode/cl_hud/vgui/mbtree.lua
new file mode 100644
index 0000000..e2be877
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mbtree.lua
@@ -0,0 +1,92 @@
+local PANEL = {}
+
+function PANEL:Init()
+ self.bgcol = MAIN_COLOR2
+ self.hovercol = MAIN_COLORD
+ self.foldecol = MAIN_COLORD2
+ self.selecCol = MAIN_GREENCOLOR
+
+ self.VBar.Paint = function(s) end
+ self.VBar.btnGrip.Paint = function(s) DrawRect( 2 , 0 , s:GetWide()-4 , s:GetTall() , self.bgcol ) end
+ self.VBar.btnDown.Paint = function(s) DrawRect( 2 , 2 , s:GetWide()-4 , s:GetTall()-4 , self.bgcol ) end
+ self.VBar.btnUp.Paint = function(s) DrawRect( 2 , 2 , s:GetWide()-4 , s:GetTall()-4 , self.bgcol ) end
+
+ self.Delta = 0
+ self.Smooth = 0
+ self.BGEnabled = true
+end
+
+function PANEL:OnMouseWheeled(Delta)
+ self.Delta = self.Delta+Delta
+end
+
+function PANEL:SetVScroll(num)
+ self.VBar:SetScroll(num)
+end
+
+function PANEL:AddVScroll(num)
+ self.VBar:AddScroll(num)
+end
+
+function PANEL:SetBGColor( col )
+ self.bgcol = col
+end
+
+function PANEL:EnableNodeBG( bool )
+ self.BGEnabled = bool
+end
+
+function PANEL:AddNode( text )
+ local V = self.BaseClass.AddNode( self, text )
+
+ V.BGEnabled = self.BGEnabled
+
+ V.FolCol = self.foldecol
+ V.HovCol = self.hovercol
+ V.SelCol = self.selecCol
+ V.OAddNode = V.AddNode
+
+ V.Label:SetFont("Trebuchet18")
+ V.Label.Paint = function(s,w,h)
+ if (V:HasChildren() and V.BGEnabled) then DrawRect( 0 , 1 , w , h-2 , V.FolCol )
+ elseif (!V:HasChildren() and self:GetSelectedItem()==V) then DrawRect( 0 , 1 , w , h-2 , V.SelCol )
+ elseif (V.Hovered) then DrawRect( 0 , 1 , w , h-2 , V.HovCol ) end
+ end
+
+ V.AddNode = function(s,txt)
+ local D = s.OAddNode(s,txt)
+
+ D.FolCol = s.FolCol
+ D.HovCol = s.HovCol
+ D.SelCol = s.SelCol
+ D.BGEnabled = s.BGEnabled
+
+ D.Label:SetFont("Trebuchet18")
+
+ D.Label.Paint = function(p,w,h)
+ if (D:HasChildren() and D.BGEnabled) then DrawRect( 0 , 1 , w , h-2 , D.FolCol )
+ elseif (!D:HasChildren() and self:GetSelectedItem()==D) then DrawRect( 0 , 1 , w , h-2 , D.SelCol )
+ elseif (D.Hovered) then DrawRect( 0 , 1 , w , h-2 , D.HovCol ) end
+ end
+
+ D.OAddNode = D.AddNode
+ D.AddNode = s.AddNode
+
+ return D
+ end
+
+ return V
+end
+
+function PANEL:Think()
+ if (self.Delta > 0.01 or self.Delta < -0.01 or self.Smooth > 0.01 or self.Smooth < -0.01) then
+ self.Delta = self.Delta - self.Delta/8
+ self.Smooth = self.Smooth + (self.Delta-self.Smooth)/32
+ self:AddVScroll(-self.Smooth/2)
+ end
+end
+
+function PANEL:Paint()
+end
+
+vgui.Register( "MBTree", PANEL , "DTree" ) \ No newline at end of file
diff --git a/gamemode/cl_hud/vgui/mbuserbrowser.lua b/gamemode/cl_hud/vgui/mbuserbrowser.lua
new file mode 100644
index 0000000..8249662
--- /dev/null
+++ b/gamemode/cl_hud/vgui/mbuserbrowser.lua
@@ -0,0 +1,76 @@
+local PANEL = {}
+
+function PANEL:Init()
+ self.bgcol = MAIN_COLOR
+ self.fgcol = MAIN_COLOR2
+
+ self:SetTitle( "UserBrowser" )
+
+ self.HTML = vgui.Create( "HTML" , self )
+ self.HTML:OpenURL( "www.google.com" )
+
+ self.HTML.StatusChanged = function( s , str ) self.Status = str end
+ self.HTML.PageTitleChanged = function( s , title ) self:SetTitle(title) end
+ self.HTML.FinishedURL = function( s , url ) self.URLBar:SetText(url) end
+
+ self.Status = "Ready."
+
+ self.BackB = vgui.Create( "MBButton" , self )
+ self.BackB:SetText("<")
+ self.BackB:EnableHoverSound(false)
+ self.BackB.DoClick = function() self.HTML:HTMLBack() end
+
+ self.RefreshB = vgui.Create( "MBButton" , self )
+ self.RefreshB:SetText("Refresh")
+ self.RefreshB:EnableHoverSound(false)
+ self.RefreshB.DoClick = function() self.HTML:Refresh() end
+
+ self.ForwardB = vgui.Create( "MBButton" , self )
+ self.ForwardB:SetText(">")
+ self.ForwardB:EnableHoverSound(false)
+ self.ForwardB.DoClick = function() self.HTML:HTMLForward() end
+
+ self.URLBar = vgui.Create( "DTextEntry" , self )
+ self.URLBar:SetText("www.google.com")
+ self.URLBar.OnEnter = function(s) self.HTML:OpenURL(s:GetValue()) end
+end
+
+function PANEL:OpenURL(url)
+ self.HTML:OpenURL(url)
+end
+
+function PANEL:SetFGColor( col )
+ self.fgcol = col
+end
+
+function PANEL:SetBGColor( col )
+ self.bgcol = col
+end
+
+function PANEL:Paint(w,h)
+ DrawBoxy( 0 , 0 , w , h , self.bgcol )
+ DrawLine( 0 , 20 , w , 20 , self.fgcol )
+
+ DrawText( self.Status , "Trebuchet18" , 5 , h-20 , MAIN_WHITECOLOR )
+
+ return true
+end
+
+function PANEL:PerformLayout()
+ self.HTML:SetPos(1,42)
+ self.HTML:SetSize(self:GetWide()-2,self:GetTall()-64)
+
+ self.BackB:SetPos(10,22)
+ self.BackB:SetSize(20,20)
+
+ self.RefreshB:SetPos(60,22)
+ self.RefreshB:SetSize(80,20)
+
+ self.ForwardB:SetPos(35,22)
+ self.ForwardB:SetSize(20,20)
+
+ self.URLBar:SetPos(145,22)
+ self.URLBar:SetSize(self:GetWide()-150,20)
+end
+
+vgui.Register( "MBUserBrowser", PANEL , "MBFrame" ) \ No newline at end of file