Update docs, add Editor script: Create Druid GUI Script, add simple using widgets example

This commit is contained in:
Insality
2025-04-25 20:37:00 +03:00
parent 749666a4a5
commit 6795934a1f
19 changed files with 466 additions and 77 deletions

View File

@@ -0,0 +1,10 @@
name: "using_widgets"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"using_widgets\"\n"
" component: \"/example/examples/using_widgets/using_widgets.gui\"\n"
"}\n"
""
}

View File

@@ -0,0 +1,119 @@
script: "/example/examples/using_widgets/using_widgets.gui_script"
fonts {
name: "text_bold"
font: "/example/assets/fonts/text_bold.font"
}
fonts {
name: "text_regular"
font: "/example/assets/fonts/text_regular.font"
}
textures {
name: "druid_example"
texture: "/example/assets/druid_example.atlas"
}
nodes {
position {
x: 861.0
y: 545.0
}
scale {
x: 3.0
y: 3.0
}
type: TYPE_TEMPLATE
id: "memory_panel"
inherit_alpha: true
template: "/druid/widget/memory_panel/memory_panel.gui"
}
nodes {
type: TYPE_BOX
id: "memory_panel/root"
parent: "memory_panel"
template_node_child: true
}
nodes {
type: TYPE_TEMPLATE
id: "memory_panel/mini_graph"
parent: "memory_panel/root"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/mini_graph/root"
parent: "memory_panel/mini_graph"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/mini_graph/header"
parent: "memory_panel/mini_graph/root"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "memory_panel/mini_graph/text_header"
parent: "memory_panel/mini_graph/header"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/mini_graph/icon_drag"
parent: "memory_panel/mini_graph/header"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/mini_graph/content"
parent: "memory_panel/mini_graph/root"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/mini_graph/prefab_line"
parent: "memory_panel/mini_graph/content"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/mini_graph/color_low"
parent: "memory_panel/mini_graph/content"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/content"
parent: "memory_panel/root"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "memory_panel/text_max_value"
parent: "memory_panel/content"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "memory_panel/text_per_second"
parent: "memory_panel/content"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/line_second_1"
parent: "memory_panel/content"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "memory_panel/line_second_2"
parent: "memory_panel/content"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "memory_panel/text_memory"
parent: "memory_panel/content"
template_node_child: true
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -0,0 +1,25 @@
local druid = require("druid.druid")
local memory_panel = require("druid.widget.memory_panel.memory_panel")
function init(self)
self.druid = druid.new(self)
self.memory_panel = self.druid:new_widget(memory_panel, "memory_panel")
end
function final(self)
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end