Suppose I have a single button placed in the top right corner. When you click on it a function (via OnClick) then creates a panel populated with 8 buttons. The very last button is labeled "Exit" and its 'Onclick' function does nothing more then turn the panel invisible. So what happens when I do this again, or 5 times, or a hundred times? Does Loveframes keep making new objects or does it keep just what it needs? Would it be better to create the objects (The first button, the panel, and the panel objects) with some sort of init function in love.load? Or does it even matter?
If it doesn't matter and there are no hidden 'gotchas' I've yet to notice, I think I might be able to reduce or eliminate some module dependencies. Hopefully this post made some sense, but I doubt it. Any suggestions or comments appreciated.
One other thing is this. In the documentation on skinning it is stated:
Code: Select all
loveframe.util.SetActiveSkin("SKINNAME")
Doing this will change the active skin. If you only want to change the skin of one object you can do so like this:
local panel = loveframes.Create("panel")
panel:SetSkin("SKINNAME")
**Doing this will change the object's skin to the skin specified. It will also change all of the object's children's skins recursively.**
Code: Select all
local panel = loveframes.Create("panel")
panel:SetSkin("WWar"):SetSize(500, 500):SetPos(512, 384, true)
local button = loveframes.Create("button", panel)
button:SetSize(32,14):SetText("Testing"):CenterX():SetY(32)
button.OnClick = function() end
local button2 = loveframes.Create("button", panel)
button2:SetSize(32,14):SetText("Exit"):CenterX():SetY(50)
button.OnClick = function()
panel:SetVisible(false)
end