Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sunrise_load_hud()
- if sunrise_hud then
- sunrise_clear_hud()
- end
- sunrise_hud = {}
- local Wide = ScrW() / 3
- local Tall = ScrH() / 5
- local X = ScrW() - Wide
- local Y = ScrH() - Tall
- local frame = vgui.Create"DFrame"
- sunrise_hud.frame = frame
- frame:SetTitle"Sunrise Hud"
- frame:SetSize(Wide, Tall+22)
- frame:SetPos(X, Y-22)
- local panel = vgui.Create("DColouredBox", frame)
- sunrise_hud.panel = panel
- panel:SetColor(Color(100, 100, 100, 200))
- panel:SetPos(0, 22)
- panel:SetSize(Wide, Tall)
- local overlay = vgui.Create("DImage", panel)
- sunrise_hud.overlay = overlay
- overlay:SetImage"gui/center_gradient"
- overlay:SetImageColor(Color(150, 150, 150, 75))
- overlay:SetPos(0, 0)
- overlay:SetSize(Wide, Tall)
- sunrise_hud.buttons = {}
- for i=1, 3 do
- local button = vgui.Create("DButton", overlay)
- sunrise_hud.buttons[i] = button
- button:SetPos((i-1)*Wide/3, 0)
- button:SetSize(Wide/3, Tall)
- button:SetText("Button "..i)
- function button:DoClick()
- Msg(("Button %d (%s) was pressed\n"):format(i, tostring(self)))
- end
- end
- end
- function sunrise_clear_hud()
- for i, v in ipairs(sunrise_hud.buttons) do
- v:Remove()
- end
- sunrise_hud.overlay:Remove()
- sunrise_hud.panel:Remove()
- sunrise_hud.frame:Remove()
- end
- hook.Add("InitPostEntity", "sunrisedev", sunrise_load_hud)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement