Files
pfUI/modules/pixelperfect.lua
T
Brues f37ea00226 Give pfUI its own EventRegistry and move event-only frames onto it
pfUI.events was a bare CallbackRegistry for pfUI's custom events. Build it
from ClassicAPI's EventRegistry instead, so the same object also takes game
events through RegisterFrameEventAndCallback, sharing one frame for all of
them.

Move the frames that existed only to listen for a few events onto it:
libspell, focus, pixelperfect, innervatecall, loothistory, unusable,
equipmentmanager (bank + window refresh), the actionbar grid, updatenotify,
turtle-wow's steady shot, nampower's spell queue, superwow's group tracking
and unitxp's notifications, plus newitem and mapreveal, which used the
global EventRegistry. Handlers take their payload as arguments instead of
the event/arg globals, and the per-frame PLAYER_LOGOUT teardown goes away,
since the registry unregisters its frame on logout.
2026-10-30 12:37:56 -05:00

44 lines
1021 B
Lua

pfUI:RegisterModule("pixelperfect", function ()
-- pre-calculated min values
local statics = {
[4] = 1.4222222222222,
[5] = 1.1377777777778,
[6] = 0.94814814814815,
[7] = 0.81269841269841,
[8] = 0.71111111111111,
}
-- pixel perfect
local function pixelperfect()
local conf = tonumber(C.global.pixelperfect)
if conf < 4 then
-- restore gamesettings
local scale = GetCVar("uiScale")
local use = GetCVar("useUiScale")
if use == 1 then
UIParent:SetScale(tonumber(use))
else
UIParent:SetScale(.9)
end
else
local scale = conf and statics[conf] or 1
SetCVar("uiScale", scale)
SetCVar("useUiScale", 1)
UIParent:SetScale(scale)
end
end
-- pixelperfect: native UIScale listener
if tonumber(C.global.pixelperfect) > 0 then
pfUI.events:RegisterFrameEventAndCallback("PLAYER_ENTERING_WORLD", pixelperfect)
pixelperfect()
end
pfUI.pixelperfect = {
UpdateConfig = pixelperfect
}
end)