panel: add colors to the fps and latency display

This commit is contained in:
shagu
2020-06-30 20:08:09 +02:00
parent 66aa9a587e
commit 7ea4fa8521
3 changed files with 15 additions and 2 deletions
+2
View File
@@ -520,6 +520,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("panel", "right", "right", "gold")
pfUI:UpdateConfig("panel", "other", "minimap", "zone")
pfUI:UpdateConfig("panel", "micro", "enable", "0")
pfUI:UpdateConfig("panel", nil, "fpscolors", "1")
pfUI:UpdateConfig("panel", "bag", "ignorespecial", "1")
pfUI:UpdateConfig("panel", "xp", "xp_always", "0")
pfUI:UpdateConfig("panel", "xp", "xp_display", "XPFLEX")
+1
View File
@@ -1945,6 +1945,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Enable Micro Bar"], C.panel.micro, "enable", "checkbox")
CreateConfig(nil, T["Enable 24h Clock"], C.global, "twentyfour", "checkbox")
CreateConfig(nil, T["Servertime"], C.global, "servertime", "checkbox")
CreateConfig(U["panel"], T["Show FPS and Latency Colors"], C.panel, "fpscolors", "checkbox")
CreateConfig(nil, T["Auto Hide"], nil, nil, "header")
CreateConfig(nil, T["Enable Autohide For Left Chat Panel"], C.panel, "hide_leftchat", "checkbox")
+12 -2
View File
@@ -138,6 +138,7 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
do -- FPS & Lag
local widget = CreateFrame("Frame", "pfPanelWidgetLag", UIParent)
local lag, fps, laghex, fpshex, _
widget.Tooltip = function()
local active = 0
GameTooltip:ClearLines()
@@ -179,8 +180,17 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
widget:SetScript("OnUpdate",function()
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + 1 end
local _, _, lag = GetNetStats()
pfUI.panel:OutputPanel("fps", floor(GetFramerate()) .. " " .. T["fps"] .. " & " .. lag .. " " .. T["ms"], widget.Tooltip, widget.Click)
fps = floor(GetFramerate())
_, _, lag = GetNetStats()
if C.panel.fpscolors == "1" then
_, _, _, fpshex = GetColorGradient(fps/60)
_, _, _, laghex = GetColorGradient(60/lag)
fps = fpshex .. fps .. "|r"
lag = laghex .. lag .. "|r"
end
pfUI.panel:OutputPanel("fps", fps .. " " .. T["fps"] .. " & " .. lag .. " " .. T["ms"], widget.Tooltip, widget.Click)
end)
end