mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Update example app
This commit is contained in:
@@ -4,6 +4,7 @@ local container = require("example.components.container.container")
|
||||
---@class example_scene: druid.base_component
|
||||
---@field root druid.container
|
||||
---@field text_debug_info druid.text
|
||||
---@field text_gui_path druid.text
|
||||
---@field druid druid_instance
|
||||
local M = component.create("example_scene")
|
||||
|
||||
@@ -15,8 +16,10 @@ function M:init(template, nodes)
|
||||
|
||||
self.root = self.druid:new(container, "root") --[[@as druid.container]]
|
||||
self.root:add_container("text_debug_info")
|
||||
self.root:add_container("text_gui_path")
|
||||
|
||||
self.text_debug_info = self.druid:new_text("text_debug_info")
|
||||
self.text_gui_path = self.druid:new_text("text_gui_path", "")
|
||||
end
|
||||
|
||||
|
||||
@@ -26,4 +29,14 @@ function M:set_debug_info(info)
|
||||
end
|
||||
|
||||
|
||||
---@param path string
|
||||
function M:set_gui_path(path)
|
||||
-- Path is a path to lua file
|
||||
-- We need add "/" before path and replace .lua to .gui
|
||||
path = "/" .. path:gsub(".lua", ".gui")
|
||||
|
||||
self.text_gui_path:set_to(path)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user