mirror of
https://github.com/Insality/druid
synced 2025-09-27 10:02:19 +02:00
Update examples to widgets instead components
This commit is contained in:
@@ -10,7 +10,7 @@ function M.get_examples()
|
||||
template = "intro",
|
||||
root = "intro/root",
|
||||
code_url = "example/examples/intro/intro/intro.lua",
|
||||
component_class = require("example.examples.intro.intro.intro"),
|
||||
widget_class = require("example.examples.intro.intro.intro"),
|
||||
},
|
||||
--{
|
||||
-- name_id = "ui_example_how_to_use_example",
|
||||
@@ -18,9 +18,9 @@ function M.get_examples()
|
||||
-- template = "how_to_use_example",
|
||||
-- root = "how_to_use_example/root",
|
||||
-- code_url = "example/examples/intro/how_to_use_example/how_to_use_example.lua",
|
||||
-- component_class = require("example.examples.intro.how_to_use_example.how_to_use_example"),
|
||||
-- widget_class = require("example.examples.intro.how_to_use_example.how_to_use_example"),
|
||||
--}
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
return M
|
||||
|
@@ -1,13 +1,9 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class examples.how_to_use_example: druid.component
|
||||
---@class examples.how_to_use_example: druid.widget
|
||||
---@field root node
|
||||
local M = component.create("how_to_use_example")
|
||||
local M = {}
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
function M:init()
|
||||
self.root = self:get_node("root")
|
||||
|
||||
self.druid:new_rich_text("text_hello", "He<color=#E48155>ll</color>o!")
|
||||
|
@@ -1,15 +1,13 @@
|
||||
local component = require("druid.component")
|
||||
local panthera = require("panthera.panthera")
|
||||
local intro_panthera = require("example.examples.intro.intro.intro_panthera")
|
||||
|
||||
---@class examples.intro: druid.component
|
||||
---@class examples.intro: druid.widget
|
||||
---@field root node
|
||||
local M = component.create("intro")
|
||||
---@field animation panthera.instance
|
||||
local M = {}
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
function M:init()
|
||||
self.root = self:get_node("root")
|
||||
|
||||
self.druid:new_rich_text("text_hello", "He<color=#E48155>ll</color>o!")
|
||||
@@ -24,7 +22,7 @@ function M:init(template, nodes)
|
||||
:add("sponsor_kofi")
|
||||
:set_margin(8, 0)
|
||||
|
||||
self.animation = panthera.create_gui(intro_panthera, self:get_template(), nodes)
|
||||
self.animation = panthera.create_gui(intro_panthera, self:get_template(), self:get_nodes())
|
||||
panthera.play(self.animation, "idle", { is_loop = true })
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user