Add class component and druid_instance

This commit is contained in:
Insality
2020-02-03 22:08:49 +03:00
parent 8c011dcc27
commit be8869951a
20 changed files with 404 additions and 154 deletions

View File

@@ -9,7 +9,8 @@ local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.system.component")
local M = component.new("button", { const.ON_INPUT })
local M = component.create("button", { const.ON_INPUT })
--- Component init function
-- @function button:init
@@ -21,6 +22,7 @@ local M = component.new("button", { const.ON_INPUT })
-- @tparam[opt] string event Button react event, const.ACTION_TOUCH by default
function M.init(self, node, callback, params, anim_node, event)
assert(callback, "Button should have callback. To block input on zone use blocker component")
self.style = self:get_style()
self.node = helper.get_node(node)