VXP

Wiremod E2 tooltip test

VXP
May 8th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. local test = LocalPlayer():GetEyeTrace().Entity
  2.  
  3. local function wtfgarry( str )
  4.     local w, h = 0, 0
  5.     local expl = string.Explode( "\n", str )
  6.     for i=1,#expl do
  7.         local _w, _h = surface.GetTextSize( expl[i] )
  8.         w = math.max(w,_w)
  9.         h = h + _h
  10.     end
  11.     return w, h
  12. end
  13.  
  14. function test:GetOverlayData()
  15.     local tbl = {}
  16.     tbl.prfbench = 100
  17.     tbl.prfcount = 2050
  18.     tbl.timebench = 1005
  19.     tbl.txt = wtfgarry( "200\n300" )
  20.     return tbl
  21. end
  22.  
  23. local WorldTip = { dietime = 0 }
  24. WorldTip.dietime = SysTime() + 0.05
  25. WorldTip.ent = test
  26.  
  27. hook.Add("HUDPaint","wire_draw_world_tips",function()
  28.     --if SysTime() > WorldTip.dietime then return end
  29.    
  30.         local ent = WorldTip.ent
  31.         if not IsValid(ent) then return end
  32.        
  33.         ent:DrawWorldTip()
  34.     end)
Advertisement
Add Comment
Please, Sign In to add comment