Aside from the syntax error in the second example, it will have significant problems considering you are potentially creating a new function for every FPS.
copy/paste fail... it's early over here ;)
But yeah, as I thought. Keep it clean.
Something else bubbled up though:
I've got a config file, with a global config
config.lua
config = {
["1"] = {
etcetc
Is there a benefit from renaming that to locals? As everything is passed by reference, that local and global (until either changes) point to the same memory location... what is the benefit of using renaming (local x = config.y) as I so often see in addons? Or is that only "should the global change due to outside influence, at least the local has the original value"?
local a, b, c, d, e
local frame = CreateFrame("Frame")
local function foofoo()
do
stuff
end
end
local function foo()
a, b = wowBarZ()
c = wowBarY()
d, e = wowBarX()
if (a and c) or (e and c) then
foofoo()
print(format("%s%s", b, d))
end
end
frame:SetScript("OnUpdate", foo)
local frame = CreateFrame("Frame")
local function foo()
local a, b = wowBarZ()
local c = wowBarY()
local d, e = wowBarX()
if (a and c) or (e and c) then
local function foofoo()
do
stuff
end
print(format("%s%s", b, d))
end
end
frame:SetScript("OnUpdate", foo)
note: don't mind syntax and all - it's just for the idea
I think you can spot the difference, in the first, all vars are declared and all functions have the file as scope and thus are instantiated. The second, everything that is needed is instantiated on the fly.
Now with the garbage collector in play, I was wondering what was the least intensive way of doing things, aka, what creates the lesser load? Keeping in mind that lua passes by reference...
The first will ofcourse have more initial memory, but having everything at the ready, it only needs to access/read that memory rather then create/write it first.
The second has the benefit of having less constant memory, but higher peak memory. This also needs to be removed again by the garbage collector. Memory jumps a lot more so to say. It is more memory-usage-intensive.
Now the above are only small things with minor impact, however, when doing stuff like tooltips, if on every tooltip-call you have to create roughly 40 locals (random number), when you're mousing through dalaran, you're creating quite a lot of em...
However, it seems the font(string) is limited in size/handling? What I mean is, the n, t and capital R for instance don't render fully, which kinda sucks and destroys the font (they are cut-off about three quarters above the baseline, the bottom part does not show). Initially I thought this was due to the UF, however when testing with
if all you want is the greyscale on non-self buffs, shouldn't it just be something like:
local texture = control.texture
texture:SetTexture(icon)
if db.zoom_aura then
texture:SetTexCoord(0.07, 0.93, 0.07, 0.93)
else
texture:SetTexCoord(0, 1, 0, 1)
end
-- insert this below the above
-- seems is_mine toggles your own or other peeps (de)buffs?
if not control.is_mine then
texture:SetDesaturated(true)
end
seems all there is to it, but this highly depends on what the is_mine actually is...
as the title suggests, which of the 3 should I take?
I've got a new, completely home-coded UI - fully Lua except for some things I think the addons win in addons vs DIY (Omen, Skada).
Note: I didn't use libraries, since I did not need them, the UI is not for distribution and should someone *really* want it, them can alter it via my config.lua.
It is however modular in setup and as much OOP as possible (got a JAVA background)
That about the UI, then why the UF question?
Well, I've always used Pitbull (PB4 atm), I'm accustomed to it, yet there still are some things I'd like more control about (which I might just not know how to do), for instance text positioning. Even though with hours of work you can make it do what you want for 95%, it's the 5% that I can't (or don't know how to) control that annoys me.[1]
I've heard a lot of good stories about sUF, and there is an "advanced" config available. To be honest I have only tried it once for an hour or 2 and then switched back to Pitbull since that just worked better for me, but seeing I want to basicly control everything, perhaps this is more suited for that then Pitbull? No clue, just including it due to the great feedback I got for it.
Then there is ofcourse oUF. This will require a lot of coding, and that is what seems to be the drawback here. Not that I have an issue with that, but why (possibly) try to rediscover the wheel when it has already been done? Besides that, the updates are convenient ofcourse ;)
So what I want:
- pixelperfect control over every aspect of the UF's, for instance the (or my) inability to fully control the placing of text in PB4 as well as for instance (what I could not find/get to work) the inability to separate my debufss from rest-of-the-raid debuffs etc.
- the ability to store 5 separate layouts (solo, party, 10/25 raid, BG's, arena) and LoD the one that I need.
The amount of work is not the issue, I can spare the time at the moment and/or will find the time anyways.
Thanks in advance for any tips, all feeback is appreciated (if you need more info, by all means ask)
--[[
function EthenaUIDB:CreatePanel
creates a new frame with the specified variables.
@param string name the name of the frame
@param string parent the parent of the frame
@param int width the width of the frame
@param int height the height of the frame
@param enum anchSelf the point where it anchors
@param enum anchParent the point where it anchors to
@param int xOff the x-axis offset
@param int yOff the y-axis offset
@return Frame panel the created panel
]]--
function EthenaUIDB:CreatePanel(name, parent, width, height, anchSelf, anchParent, xOff, yOff, alpha)
--determine the parent, UIParent by default
if parent == nil then
parent = UIParent
end
local panel = CreateFrame("Frame", name, parent)
panel:SetWidth(width)
panel:SetHeight(height)
panel.bg = panel:CreateTexture(nil, "PARENT")
panel.bg:SetTexCoord(0,1,0,1)
panel.bg:SetBlendMode("BLEND")
panel.bg:SetAlpha(1)
panel.bg:SetGradientAlpha("VERTICAL",
unpack(EthenaUIDB["color"]["gradient"]))
panel.bg:SetTexture( 1, 1, 1, alpha)
panel:SetBackdrop(EthenaUIDB["default_backdrop"])
panel:SetBackdropColor(unpack(EthenaUIDB["color"]["backdrop"]) )
panel:SetBackdropBorderColor(unpack(EthenaUIDB["color"]["backdropborder"]))
panel.bg:SetPoint("TOPLEFT", panel, "TOPLEFT", 1, -1)
panel.bg:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -1, 1)
local level = 1
if parent ~= UIParent then
level = parent:GetFrameLevel()
end
panel:SetFrameLevel(level)
panel:SetFrameStrata("BACKGROUND")
panel.bg:SetDrawLayer("BACKGROUND")
panel:SetPoint(anchSelf, parent, anchParent, xOff, yOff)
return panel
end
creates an easy, reusable, stackable panel system for me, with which I can easily adjust panels, settings etc. ( It are all abstracts from the config.lua, core.lua and panels.lua respectively)
Yet those pesky borders... they won't show. I don't get any errors, the code is loaded, everything works, except those borders... The file exists, but even when tested with ["edge"] = [[Interface\Tooltips\UI-Tooltip-Border]], or inline values, it does not work.
It's probably something very stupid, silly or a gross mistake, but I can't find what.
If you're not planing on doing different things for different events, you don't need to check for them, the event handler never fires for events that you don't explicitly register for.
Also, you can lose a tiny amount of overhead by doing this:
I've finally ran into a brick wall... I wanted to add a panel with the name of the zone on it, however it does not seem to be willing to update on the events listed, better yet, it does not fire any of these events when changing (sub)zone, only on first load...
local frame = EthenaUICore:CreatePanel("locationtext", EthenaUIDB["panels"]["top_location"],300,19, "CENTER", "CENTER", 0, 0, 0)
frame:EnableMouse(true)
-- function EthenaUIFunc:GetZoneText()
--...
--this works
--...
--end
frame:RegisterEvent("ZONE_CHANGED", "EthenaUIFunc:GetZoneText")
frame:RegisterEvent("ZONE_CHANGED_INDOORS", "EthenaUIFunc:GetZoneText")
frame:RegisterEvent("ZONE_CHANGED_NEW_AREA", "EthenaUIFunc:GetZoneText")
N.B.: EthenaUIFunc:CreatePanel is a custom function to easily add generic frames with a default or customized layout to the UIstack, on the proper strata, level, size, location etc etc.
Now I could have it update every sec - like the clock I have - but that is kinda pointless most of the time, thus a waste of resources.
I have no clue why the events don't fire... if needed I am more then willing to post the function code as well, but that works just fine, the initial display works like a charm (incl. tooltip)
Any ideas what it could be or what I'm doing wrong?
0
copy/paste fail... it's early over here ;)
But yeah, as I thought. Keep it clean.
Something else bubbled up though:
I've got a config file, with a global config
config.lua
Is there a benefit from renaming that to locals? As everything is passed by reference, that local and global (until either changes) point to the same memory location... what is the benefit of using renaming (local x = config.y) as I so often see in addons? Or is that only "should the global change due to outside influence, at least the local has the original value"?
0
I'm wondering about something...
Consider the 2 following examples:
note: don't mind syntax and all - it's just for the idea
I think you can spot the difference, in the first, all vars are declared and all functions have the file as scope and thus are instantiated. The second, everything that is needed is instantiated on the fly.
Now with the garbage collector in play, I was wondering what was the least intensive way of doing things, aka, what creates the lesser load? Keeping in mind that lua passes by reference...
The first will ofcourse have more initial memory, but having everything at the ready, it only needs to access/read that memory rather then create/write it first.
The second has the benefit of having less constant memory, but higher peak memory. This also needs to be removed again by the garbage collector. Memory jumps a lot more so to say. It is more memory-usage-intensive.
Now the above are only small things with minor impact, however, when doing stuff like tooltips, if on every tooltip-call you have to create roughly 40 locals (random number), when you're mousing through dalaran, you're creating quite a lot of em...
Which would have the lesser impact on a system?
0
feared as much :( Shame really... should someone know a similar font with less curls..... :cool:
0
On my UnitFrames I'm running into a problem (using oUF)
For some specific texts I had my heart set on the font Bleeding Cowboy (safe link, check http://www.dafont.com and search it yourself (right side) if you don't believe me, it just renders a font showcase) --> http://www.dafont.com/bleeding-cowboys.font.
However, it seems the font(string) is limited in size/handling? What I mean is, the n, t and capital R for instance don't render fully, which kinda sucks and destroys the font (they are cut-off about three quarters above the baseline, the bottom part does not show). Initially I thought this was due to the UF, however when testing with
it shows the exact same effect (these are the quest headers in the questlog).
Any ideas what it could be, if it's fixable and if so how?
Thanks in advance!
/salute
0
seems all there is to it, but this highly depends on what the is_mine actually is...
0
0
as the title suggests, which of the 3 should I take?
I've got a new, completely home-coded UI - fully Lua except for some things I think the addons win in addons vs DIY (Omen, Skada).
Note: I didn't use libraries, since I did not need them, the UI is not for distribution and should someone *really* want it, them can alter it via my config.lua.
It is however modular in setup and as much OOP as possible (got a JAVA background)
That about the UI, then why the UF question?
Well, I've always used Pitbull (PB4 atm), I'm accustomed to it, yet there still are some things I'd like more control about (which I might just not know how to do), for instance text positioning. Even though with hours of work you can make it do what you want for 95%, it's the 5% that I can't (or don't know how to) control that annoys me.[1]
I've heard a lot of good stories about sUF, and there is an "advanced" config available. To be honest I have only tried it once for an hour or 2 and then switched back to Pitbull since that just worked better for me, but seeing I want to basicly control everything, perhaps this is more suited for that then Pitbull? No clue, just including it due to the great feedback I got for it.
Then there is ofcourse oUF. This will require a lot of coding, and that is what seems to be the drawback here. Not that I have an issue with that, but why (possibly) try to rediscover the wheel when it has already been done? Besides that, the updates are convenient ofcourse ;)
So what I want:
- pixelperfect control over every aspect of the UF's, for instance the (or my) inability to fully control the placing of text in PB4 as well as for instance (what I could not find/get to work) the inability to separate my debufss from rest-of-the-raid debuffs etc.
- the ability to store 5 separate layouts (solo, party, 10/25 raid, BG's, arena) and LoD the one that I need.
The amount of work is not the issue, I can spare the time at the moment and/or will find the time anyways.
Thanks in advance for any tips, all feeback is appreciated (if you need more info, by all means ask)
/salute
0
gah, can you believe I am overlooking that for about 3 days now? Got both the http://wowprogramming.com/docs/widgets/Frame/SetBackdrop and http://www.wowwiki.com/API_Frame_SetBackdrop open and still didn't see it... :rolleyes:
I'm going to hide in shame. Thanks peeps, much appreciated!
0
I can't get my head round getting borders around my frame...
Settings:
Implementation:
this, used as following:
creates an easy, reusable, stackable panel system for me, with which I can easily adjust panels, settings etc. ( It are all abstracts from the config.lua, core.lua and panels.lua respectively)
Yet those pesky borders... they won't show. I don't get any errors, the code is loaded, everything works, except those borders... The file exists, but even when tested with ["edge"] = [[Interface\Tooltips\UI-Tooltip-Border]], or inline values, it does not work.
It's probably something very stupid, silly or a gross mistake, but I can't find what.
Please help :confused:
Thanks in advance!
/salute
0
It was just an excerpt, it is registered to several other events as well. Thanks for the tips though! Every optimization is good!
0
forgot to actually add the onEvent....
working as intended with:
0
I've finally ran into a brick wall... I wanted to add a panel with the name of the zone on it, however it does not seem to be willing to update on the events listed, better yet, it does not fire any of these events when changing (sub)zone, only on first load...
N.B.: EthenaUIFunc:CreatePanel is a custom function to easily add generic frames with a default or customized layout to the UIstack, on the proper strata, level, size, location etc etc.
I've tested the firing with
but this only fires once, onload...
Now I could have it update every sec - like the clock I have - but that is kinda pointless most of the time, thus a waste of resources.
I have no clue why the events don't fire... if needed I am more then willing to post the function code as well, but that works just fine, the initial display works like a charm (incl. tooltip)
Any ideas what it could be or what I'm doing wrong?
Thanks in Advance!