mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update examples to widgets instead components
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class examples.basic_blocker: druid.component
|
||||
---@field druid druid.instance
|
||||
---@class examples.basic_blocker: druid.widget
|
||||
---@field root node
|
||||
---@field blocker druid.blocker
|
||||
local M = component.create("basic_blocker")
|
||||
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
local M = {}
|
||||
|
||||
function M:init()
|
||||
self.root = self:get_node("root")
|
||||
|
||||
self.button_root = self.druid:new_button(self.root, self.on_root_click)
|
||||
@@ -20,15 +12,12 @@ function M:init(template, nodes)
|
||||
self.button = self.druid:new_button("button/root", self.on_button_click)
|
||||
end
|
||||
|
||||
|
||||
function M:on_root_click()
|
||||
print("Root click")
|
||||
end
|
||||
|
||||
|
||||
function M:on_button_click()
|
||||
print("Button click")
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user