Used for registering new UI element classes.
Used for registering new UI element classes.
1 string id
The ID of the new UI element.
2 table elementClass
The table containing all the variables and classes necessary for this method.
3 string inherit
The ID of another UI element that this element should inherit. (Optional)
1 Nothing.
-- the "Panel" element taken from engine/gui/panel.lua -- register the panel here, since most (if not all) GUI elements will use it as a base local PANEL = {} PANEL.canPropagateKeyPress = true PANEL.drawColor = color(0, 0, 0, 255) function PANEL:init() self.shouldDraw = true self.alpha = 175 end function PANEL:draw( w, h ) if not self.shouldDraw then return end love.graphics.setColor(self.drawColor.r, self.drawColor.g, self.drawColor.b, self.alpha) love.graphics.rectangle("fill", 0, 0, w, h) end gui.register("Panel", PANEL)