forked from cyborgize/LoveFrames
-
Notifications
You must be signed in to change notification settings - Fork 20
(API) Collapsible Category
Caldas Lopes edited this page Jun 30, 2019
·
2 revisions
The collapsible category object can is essentially a panel that can be opened or closed and can contain one object as a child.
function love.load()
loveframes = require("loveframes")
local panel = loveframes.Create("panel")
panel:SetHeight(230)
local text = loveframes.Create("text", panel)
text:SetText("Collapsible Category")
local collapsiblecategory = loveframes.Create("collapsiblecategory")
collapsiblecategory:SetPos(5, 30)
collapsiblecategory:SetSize(490, 265)
collapsiblecategory:SetText("Category 1")
collapsiblecategory:SetObject(panel)
text:Center()
end
function love.update(dt)
loveframes.update(dt)
end
function love.draw()
loveframes.draw()
end
function love.mousepressed(x, y, button)
loveframes.mousepressed(x, y, button)
end
function love.mousereleased(x, y, button)
loveframes.mousereleased(x, y, button)
endCalled when the object is opened or closed
Arguments passed: self [object]
Sets the object's text
object:SetText(text[string])Gets the object's text
Returns 1 value: text [string]
local text = object:GetText()Sets the object's object
local panel = loveframes.Create("panel")
object:SetObject(panel)Gets the object's object
Returns 1 value: object [object]
local selfobject = object:GetObject()Sets the height of the object when it is closed
object:SetClosedHeight(height[number])Gets the height of the object when it is closed
Returns 1 value: closedheight [number]
local closedheight = object:GetClosedHeight()Sets whether the object is open or not
object:SetOpen(open[boolean])Gets whether the object is open or not
Returns 1 value: open [boolean]
local open = object:GetOpen()