This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtooltip.lua
76 lines (56 loc) · 2.61 KB
/
tooltip.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
-- ------------------------------
-- -- Localizing some crap --
-- ------------------------------
-- local MEMTHRESH = 32
-- local string_format, math_modf, GetNetStats, GetFramerate, gcinfo = string.format, math.modf, GetNetStats, GetFramerate, gcinfo
-- local function ColorGradient(perc, r1, g1, b1, r2, g2, b2, r3, g3, b3)
-- if perc >= 1 then return r3, g3, b3 elseif perc <= 0 then return r1, g1, b1 end
-- local segment, relperc = math_modf(perc*2)
-- if segment == 1 then r1, g1, b1, r2, g2, b2 = r2, g2, b2, r3, g3, b3 end
-- return r1 + (r2-r1)*relperc, g1 + (g2-g1)*relperc, b1 + (b2-b1)*relperc
-- end
-- local function formats(value)
-- if(value > 999) then
-- return format('%.1f MiB', value / 1024)
-- else
-- return format('%.1f KiB', value)
-- end
-- end
-- ------------------------
-- -- Tooltip! --
-- ------------------------
-- local onEnter = function(self)
-- GameTooltip:SetOwner(TimeManagerClockButton, "ANCHOR_BOTTOMRIGHT")
-- local fps = GetFramerate()
-- local r, g, b = ColorGradient(fps/75, 1,0,0, 1,1,0, 0,1,0)
-- GameTooltip:AddDoubleLine("FPS:", string_format("%.1f", fps), nil,nil,nil, r,g,b)
-- local _, _, lag = GetNetStats()
-- local r, g, b = ColorGradient(lag/1000, 0,1,0, 1,1,0, 1,0,0)
-- GameTooltip:AddDoubleLine("Lag:", lag.. " ms", nil,nil,nil, r,g,b)
-- GameTooltip:AddLine(" ")
-- local addons, addon, total = {}, {}, 0
-- for i=1, GetNumAddOns() do
-- addon = {GetAddOnInfo(i), GetAddOnMemoryUsage(i)}
-- table.insert(addons, addon)
-- total = total + GetAddOnMemoryUsage(i)
-- end
-- table.sort(addons, (function(a, b) return a[2] > b[2] end))
-- UpdateAddOnMemoryUsage()
-- for i,addons in pairs(addons) do
-- if addons[2] > MEMTHRESH then
-- local r, g, b = ColorGradient((addons[2] - MEMTHRESH)/768, 0,1,0, 1,1,0, 1,0,0)
-- local memstr = addons[2] > 1024 and string_format("%.1f MiB", addons[2]/1024) or string_format("%.1f KiB", addons[2])
-- GameTooltip:AddDoubleLine(addons[1], memstr, 1,1,1, r,g,b)
-- end
-- end
-- GameTooltip:AddLine(" ")
-- local r, g, b = ColorGradient(total/(40*1024), 0,1,0, 1,1,0, 1,0,0)
-- GameTooltip:AddDoubleLine("Addon memory:", string_format("%.2f MiB", total/1024), nil,nil,nil, r,g,b)
-- local mem = collectgarbage("count")
-- local r, g, b = ColorGradient(mem/(20*1024), 0,1,0, 1,1,0, 1,0,0)
-- GameTooltip:AddDoubleLine("Default UI memory:", string_format("%.2f MiB", (gcinfo()-total)/1024), nil,nil,nil, r,g,b)
-- GameTooltip:AddLine(" ")
-- GameTooltip:Show()
-- end
-- TimeManagerClockButton:SetScript("OnEnter", onEnter)
-- TimeManagerClockButton:SetScript("OnLeave", function() GameTooltip:Hide() end)