Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. -- make the grey box
  2.  
  3. local Wide = ScrW() / 3
  4. local Tall = ScrH() / 5
  5. --[[ Constant offset makes it fall off my screen
  6. local X = ScrW() - 390
  7. local Y = ScrH() - 175
  8. --]]
  9. local X, Y = ScrW()-Wide, ScrH()-Tall
  10.  
  11. hook.Add("HUDPaint", "sunrisedev", function()
  12.     local GOverlay = surface.GetTextureID( "gui/center_gradient" )
  13.  
  14.     draw.RoundedBox(0, X, Y, Wide, Tall, Color(0,0,0,200))
  15.     surface.SetDrawColor( 100,100,100,255 )
  16.     surface.DrawOutlinedRect( X-0, Y-0, Wide+0, Tall+0 )
  17.  
  18.     surface.SetTexture( GOverlay )
  19.     surface.SetDrawColor( 150, 150, 150, 75)
  20.     surface.DrawTexturedRect( X, Y, Wide, Tall )
  21. end)
  22.  
  23. local BorderSize = 20
  24. local ButtonInfo = {
  25.     "VGUI/entities/npc_hunter",
  26.     "VGUI/entities/npc_combine_s",
  27.     "VGUI/entities/npc_metropolice"
  28. }
  29. hook.Add("InitPostEntity", "sunrisedev", function()
  30.     local ButtonWide = (Wide - BorderSize * (1 + #ButtonInfo)) / #ButtonInfo
  31.     local ButtonTall = Tall - BorderSize * 2
  32.  
  33.     for i, bdata in ipairs(ButtonInfo) do
  34.         local btn = vgui.Create("DImageButton")
  35.             btn:SetPos(X + BorderSize * i + ButtonWide * (i-1),
  36.                        Y + BorderSize)
  37.             btn:SetSize(ButtonWide, ButtonTall)
  38.             btn:SetMaterial(bdata)
  39.             function btn:DoClick()
  40.                 MsgN("Pressed button ", i, ", ", bdata)
  41.             end
  42.     end
  43. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement