Add settings to color fps and latency

This commit is contained in:
Robin Hüskes 2022-11-27 12:30:38 +01:00
parent badd83aa5e
commit 896c9b7c1c
5 changed files with 115 additions and 11 deletions

View File

@ -114,6 +114,9 @@ end
local function toggleColor(col,col1,col2)
return col == col1 and col2 or col1
end
local function computelatency()
return select(3,GetNetStats())
end
local function compute()
local c = date(db['clockstring'])
local d = date(db['datestring'])
@ -122,7 +125,7 @@ local function compute()
d = d:gsub(k, L[k])
end
end
local h, w = select(3,GetNetStats())
local h, w = computelatency()
local l = db['latencystring']
l = l:gsub("%%world", w)
l = l:gsub("%%local", h)
@ -204,8 +207,30 @@ local function OnDataUpdate()
line = db['ldbstring']
line = line:gsub("%%clock", child:colorize(c,db['clockcolor']))
line = line:gsub("%%date", child:colorize(d,db['datecolor']))
line = line:gsub("%%fps", child:colorize(f,db['fpscolor']))
line = line:gsub("%%latency", child:colorize(l,db['latencycolor']))
local fpscolor = db['fpscolor']
local fr = floor(GetFramerate())
if(db['fpslow'] and tonumber(db['fpslow']) > 0 and tonumber(fr) <= tonumber(db['fpslow'])) then
fpscolor = db['fpslowcolor']
end
if(db['fpsmedium'] and tonumber(db['fpsmedium']) > 0 and tonumber(fr) >= tonumber(db['fpsmedium'])) then
fpscolor = db['fpsmediumcolor']
end
if(db['fpshigh'] and tonumber(db['fpshigh']) > 0 and tonumber(fr) >= tonumber(db['fpshigh'])) then
fpscolor = db['fpshighcolor']
end
line = line:gsub("%%fps", child:colorize(f,fpscolor))
local latencycolor = db['latencycolor']
local h, w = computelatency()
if(db['latencylow'] and tonumber(db['latencylow']) > 0 and tonumber(w) <= tonumber(db['latencylow'])) then
latencycolor = db['latencylowcolor']
end
if(db['latencymedium'] and tonumber(db['latencymedium']) > 0 and tonumber(w) >= tonumber(db['latencymedium'])) then
latencycolor = db['latencymediumcolor']
end
if(db['latencyhigh'] and tonumber(db['latencyhigh']) > 0 and tonumber(w) >= tonumber(db['latencyhigh'])) then
fpscolor = db['latencyhighcolor']
end
line = line:gsub("%%latency", child:colorize(l,latencycolor))
else
line = ''
if(db["showClock"]) then

View File

@ -33,6 +33,18 @@ child['specs'] = {
['fpscolor'] = defcolor,
['clockcolor'] = defcolor,
['latencycolor'] = "ffff00",
['fpshighcolor'] = defcolor,
['fpsmediumcolor'] = defcolor,
['fpslowcolor'] = defcolor,
['latencyhighcolor'] = defcolor,
['latencymediumcolor'] = defcolor,
['latencylowcolor'] = defcolor,
['fpshigh'] = 0,
['fpsmedium'] = 0,
['fpslow'] = 0,
['latencyhigh'] = 0,
['latencymedium'] = 0,
['latencylow'] = 0,
}
}
}

View File

@ -82,10 +82,29 @@ if L then
L['CPU'] = 'CPU'
L['total'] = 'Gesamt'
L["CPU setting changed. Please Reload UI."] = "CPU Einstellung ge\195\164ndert. Bitte UI neu laden."
L['fpsheader'] = ""
L['Latency High'] = "Hohe Latenz"
L['Latency High Desc'] = "Setze Wert auf 0 für Standardfarbe"
L['Latency High Color'] = "Farbe hohe Latenz"
L['Latency Medium'] = "Mittlere Latenz"
L['Latency Medium Desc'] = "Setze Wert auf 0 für Standardfarbe"
L['Latency Medium Color'] = "Farbe mittlere Latenz"
L['Latency Low'] = "Niedrige Latenz"
L['Latency Low Desc'] = "Setze Wert auf 0 für Standardfarbe"
L['Latency Low Color'] = "Farbe niedrige Latenz"
L['FPS High'] = "Hohe FPS"
L['FPS High Desc'] = "Setze Wert auf 0 für Standardfarbe"
L['FPS High Color'] = "Farbe hohe FPS"
L['FPS Medium'] = "Mittlere FPS"
L['FPS Medium Desc'] = "Setze Wert auf 0 für Standardfarbe"
L['FPS Medium Color'] = "Farbe mittlere FPS"
L['FPS Low'] = "Niedrige FPS"
L['FPS Low Desc'] = "Setze Wert auf 0 für Standardfarbe"
L['FPS Low Color'] = "Farbe niedrige FPS"
end
-- <20> \195\182 <20> \195\159
-- <20> \195\188 <20> \195\164
-- <20> \195\132
-- <20> \195\182
-- <20> \195\156
-- <20> \195\182 <20> \195\159
-- <20> \195\188 <20> \195\164
-- <20> \195\132
-- <20> \195\182
-- <20> \195\156

View File

@ -82,4 +82,23 @@ if L then
L['CPU'] = 'CPU'
L['total'] = 'Total'
L["CPU setting changed. Please Reload UI."] = "CPU setting changed. Please Reload UI."
L['fpsheader'] = ""
L['Latency High'] = "Latency High"
L['Latency High Desc'] = "Set value 0 to disable this"
L['Latency High Color'] = "Latency High Color"
L['Latency Medium'] = "Latency Medium"
L['Latency Medium Desc'] = "Set value 0 to disable this"
L['Latency Medium Color'] = "Latency Medium Color"
L['Latency Low'] = "Latency Low"
L['Latency Low Desc'] = "Set value 0 to disable this"
L['Latency Low Color'] = "Latency Low Color"
L['FPS High'] = "FPS High"
L['FPS High Desc'] = "Set value 0 to disable this"
L['FPS High Color'] = "FPS High Color"
L['FPS Medium'] = "FPS Medium"
L['FPS Medium Desc'] = "Set value 0 to disable this"
L['FPS Medium Color'] = "FPS Medium Color"
L['FPS Low'] = "FPS Low"
L['FPS Low Desc'] = "Set value 0 to disable this"
L['FPS Low Color'] = "FPS Low Color"
end

View File

@ -22,8 +22,11 @@ end
function child:GetPref(pref)
--print("get", pref[#pref], pref['type'],db[pref[#pref]])
if(pref['type'] == 'color') then
local r,g,b = Hex2RGB(db[pref[#pref]])
local r,g,b = 1, 1, 1
if(db[pref[#pref]]) then
r,g,b = Hex2RGB(db[pref[#pref]])
-- print(Hex2RGB(db[pref[#pref]]))
end
return r/255,g/255,b/255,1
end
return db[pref[#pref]]
@ -51,11 +54,37 @@ local init = {
local menu3 = config:AddConfigMenu(options, L['Latency'], 5, child, { disabled = expert })
config:AddConfigEntry(menu3,"latencystring","input",L['Latency'],nil,1)
config:AddConfigEntry(menu3,"latencycolor","color",L['Latency'],nil,2)
config:AddConfigEntry(menu3,"latencyinfo","description",L['Latencystring'],nil,100)
config:AddConfigEntry(menu3,"latencyinfo","description",L['Latencystring'],nil,3)
config:AddConfigEntry(menu3,'fpsheader4',"header",L['fpsheader'],nil,4)
config:AddConfigEntry(menu3,"latencyhigh","range",L['Latency High'],L['Latency High Desc'],5,0,500,1)
config:AddConfigEntry(menu3,"latencyhighcolor","color",L['Latency High Color'],nil,6)
config:AddConfigEntry(menu3,'fpsheader5',"header",L['fpsheader'],nil,7)
config:AddConfigEntry(menu3,"latencymedium","range",L['Latency Medium'],L['Latency Medium Desc'],8,0,500,1)
config:AddConfigEntry(menu3,"latencymediumcolor","color",L['Latency Medium Color'],nil,9)
config:AddConfigEntry(menu3,'fpsheader6',"header",L['fpsheader'],nil,10)
config:AddConfigEntry(menu3,"latencylow","range",L['Latency Low'],L['Latency Low Desc'],11,0,500,1)
config:AddConfigEntry(menu3,"latencylowcolor","color",L['Latency Low Color'],nil,12)
local menu4 = config:AddConfigMenu(options, L['FPS'], 6, child, { disabled = expert })
config:AddConfigEntry(menu4,"fpsstring","input",L['FPS'],nil,1)
config:AddConfigEntry(menu4,"fpscolor","color",L['FPS'],nil,2)
config:AddConfigEntry(menu4,"fpsinfo","description",L['fpsstring'],nil,100)
config:AddConfigEntry(menu4,"fpsinfo","description",L['fpsstring'],nil,3)
config:AddConfigEntry(menu4,'fpsheader',"header",L['fpsheader'],nil,4)
config:AddConfigEntry(menu4,"fpshigh","range",L['FPS High'],L['FPS High Desc'],5,0,500,1)
config:AddConfigEntry(menu4,"fpshighcolor","color",L['FPS High Color'],nil,6)
config:AddConfigEntry(menu4,'fpsheader2',"header",L['fpsheader'],nil,7)
config:AddConfigEntry(menu4,"fpsmedium","range",L['FPS Medium'],L['FPS Medium Desc'],8,0,500,1)
config:AddConfigEntry(menu4,"fpsmediumcolor","color",L['FPS Medium Color'],nil,9)
config:AddConfigEntry(menu4,'fpsheader3',"header",L['fpsheader'],nil,10)
config:AddConfigEntry(menu4,"fpslow","range",L['FPS Low'],L['FPS Low Desc'],11,0,500,1)
config:AddConfigEntry(menu4,"fpslowcolor","color",L['FPS Low Color'],nil,12)
local menu5 = config:AddConfigMenu(options, L['LDB'], 5, child, { disabled = expert })
config:AddConfigEntry(menu5,"ldbstring","input",L['LDB'],nil,1)
config:AddConfigEntry(menu5,"ldbinfo","description",L['ldbstring'],nil,100)