-
Posted by pgstudio on Mon, 27 Feb 2012 02:03:48
Hi Guys,
I'm very new to WoW programming (former Objective C, Java programmer).
I've read about the basics and i'm wondering how to show an Icon on the screen with the Cooldown "watch" animation.
I just added an image to the screen but i don't know if i did this the correct way.
All i want to do is add an icon to my screen and start a counter (like a cooldown) within that icon. What's the best way to do that ? I'm a little bit lost about that.
Thanks in advance for any help!
-
Posted by stolenlegacy on Tue, 03 Apr 2012 22:14:01
If you're referring to the cooldown "swirl", then the Cooldown widget provides the functionality you're looking for. Define it as your icon frame's child, then
:SetAllPoints()
and activate it using either:SetCooldown(start, duration)
or the wrapper for it used in the default UI,CooldownFrame_SetTimer(self, start, duration, enable)
.Example creation code:
-- I'm assuming there's a reference to your texture frame in the variable 'tex' tex.swirl = CreateFrame("Cooldown",nil,tex) tex.swirl:SetAllPoints()
Example invocation code:
-- tex.icon is the texture object in my example. local function onCooldown(texturePath, cooldownDuration) tex.icon:SetTexture(texturePath) CooldownFrame_SetTimer(tex.swirl,GetTime(),cooldownDuration,true) tex:Show() end