Skip to content

Commit

Permalink
TWW API Update
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Jul 23, 2024
1 parent 46c1220 commit e0f97ff
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,6 @@ globals = {
"UnitChannelInfo",
"CastingInfo",
"ChannelInfo",
"C_Spell",
"C_AddOns",
}
58 changes: 58 additions & 0 deletions Frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,64 @@ local function PoolIconResetterFunc(pool, f)
f:SetPoint(scaleOrigin, parent, revOrigin, 0,0)
end


local FramePool = {
-- creationFunc = function(self)
-- return self.parent:CreateMaskTexture()
-- end,
-- resetterFunc = function(self, mask)
-- mask:Hide()
-- mask:ClearAllPoints()
-- end,
AddObject = function(self, object)
local dummy = true
self.activeObjects[object] = dummy
self.activeObjectCount = self.activeObjectCount + 1
end,
ReclaimObject = function(self, object)
tinsert(self.inactiveObjects, object)
self.activeObjects[object] = nil
self.activeObjectCount = self.activeObjectCount - 1
end,
Release = function(self, object)
local active = self.activeObjects[object] ~= nil
if active then
self:resetterFunc(object)
self:ReclaimObject(object)
end
return active
end,
Acquire = function(self)
local object = tremove(self.inactiveObjects)
local new = object == nil
if new then
object = self:creationFunc()
self:resetterFunc(object, new)
end
self:AddObject(object)
return object, new
end,
ReleaseAll = function(self)
for obj in pairs(self.activeObjects) do
self:Release(obj);
end
end,
Init = function(self, parent)
self.activeObjects = {}
self.inactiveObjects = {}
self.activeObjectCount = 0
self.parent = parent
end
}
local function CreateFramePool(frameType, parent, frameTemplate, resetterFunc, frameInitFunc)
local self = setmetatable({}, { __index = FramePool })
self:Init(parent)
self.frameType = frameType;
-- self.parent = parent;
self.frameTemplate = frameTemplate;
return self
end

function NugKeyFeedback:CreateLastSpellIconLine(parent)
local template = nil
local resetterFunc = PoolIconResetterFunc
Expand Down
2 changes: 1 addition & 1 deletion NugKeyFeedback-Mainline.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100002
## Interface: 110000
## Title: NugKeyFeedback
## SavedVariables: NugKeyFeedbackDB
## OptionalDeps: Masque, Bartender4, Neuron, ElvUI
Expand Down
19 changes: 18 additions & 1 deletion NugKeyFeedback.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ local defaults = {
forceUseActionHook = false,
}


if C_Spell.GetSpellInfo then
local C_Spell_GetSpellInfo = C_Spell.GetSpellInfo
ns.GetSpellInfo = function(spellId)
local info = C_Spell_GetSpellInfo(spellId)
if info then
return info.name, nil, info.iconID
end
end
ns.GetSpellTexture = C_Spell.GetSpellTexture
else
ns.GetSpellInfo = _G.GetSpellInfo
ns.GetSpellTexture = _G.GetSpellTexture
end
local GetSpellInfo = ns.GetSpellInfo

local APILevel = math.floor(select(4,GetBuildInfo())/10000)
local isClassic = APILevel < 5 --WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
local dummy = function() end
Expand All @@ -32,6 +48,7 @@ if isClassic then
UnitCastingInfo = CastingInfo
UnitChannelInfo = ChannelInfo
end
local IsAddOnLoaded = IsAddOnLoaded or C_AddOns.IsAddOnLoaded

local firstTimeUse = false

Expand Down Expand Up @@ -267,7 +284,7 @@ function NugKeyFeedback:RefreshSettings()

local pool = self.iconPool
pool:ReleaseAll()
for i,f in pool:EnumerateInactive() do
for i,f in ipairs(pool.inactiveObjects) do
-- f:SetHeight(db.lineIconSize)
-- f:SetWidth(db.lineIconSize)
pool:resetterFunc(f)
Expand Down

0 comments on commit e0f97ff

Please sign in to comment.