mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Update examples to widgets instead components
This commit is contained in:
@@ -1,19 +1,11 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class examples.basic_button: druid.component
|
||||
---@field druid druid.instance
|
||||
---@class examples.basic_button: druid.widget
|
||||
---@field button druid.button
|
||||
local M = component.create("basic_button")
|
||||
|
||||
---@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.button = self.druid:new_button("button/root", function()
|
||||
print("Button pressed")
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
@@ -1,15 +1,8 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class examples.basic_button_double_click: druid.component
|
||||
---@field druid druid.instance
|
||||
---@class examples.basic_button_double_click: druid.widget
|
||||
---@field button druid.button
|
||||
local M = component.create("basic_button_double_click")
|
||||
|
||||
---@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.button = self.druid:new_button("button/root", function()
|
||||
print("Click")
|
||||
end)
|
||||
@@ -19,5 +12,4 @@ function M:init(template, nodes)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
@@ -1,19 +1,13 @@
|
||||
local component = require("druid.component")
|
||||
local panthera = require("panthera.panthera")
|
||||
|
||||
local animation = require("example.examples.basic.button.basic_button_hold_panthera")
|
||||
|
||||
---@class examples.basic_button_hold: druid.component
|
||||
---@field druid druid.instance
|
||||
---@class examples.basic_button_hold: druid.widget
|
||||
---@field button druid.button
|
||||
local M = component.create("basic_button_hold")
|
||||
local M = {}
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
self.animation = panthera.create_gui(animation, self:get_template(), nodes)
|
||||
function M:init()
|
||||
self.animation = panthera.create_gui(animation, self:get_template(), self:get_nodes())
|
||||
|
||||
self.button = self.druid:new_button("button", function()
|
||||
print("Click")
|
||||
@@ -45,5 +39,4 @@ function M:init(template, nodes)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user