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

@@ -4998,6 +4998,13 @@ nodes {
parent: "container_resize/panel_content"
template_node_child: true
}
nodes {
type: TYPE_TEMPLATE
id: "use_widgets"
parent: "container"
inherit_alpha: true
template: "/example/examples/container/use_widgets/use_widgets.gui"
}
nodes {
position {
x: -20.0

View File

@@ -151,7 +151,9 @@ local function setup_components(self)
self.container_output:add_container(self.output_list.root)
self.next_example = self.druid:new_hotkey("key_down", on_next_example, self)
:add_hotkey("key_s")
self.previous_example = self.druid:new_hotkey("key_up", on_previous_example, self)
:add_hotkey("key_w")
do -- Component bindings
self.examples_list_view.on_debug_info:subscribe(function(info)

View File

@@ -57,7 +57,7 @@ nodes {
}
nodes {
position {
y: 118.0
y: -118.0
}
type: TYPE_BOX
id: "slider/slider_pin"

View File

@@ -6,7 +6,7 @@ local helper = require("druid.helper")
local M = {}
function M:init()
self.slider = self.druid:new_slider("slider/slider_pin", vmath.vector3(0, -118, 0), self.on_slider_change) --[[@as druid.slider]]
self.slider = self.druid:new_slider("slider/slider_pin", vmath.vector3(0, 118, 0), self.on_slider_change) --[[@as druid.slider]]
-- To add input across all slider widget add a root node to acquire additional input
self.slider:set_input_node("slider/root")

View File

@@ -40,7 +40,7 @@ nodes {
y: 100.0
}
type: TYPE_TEXT
text: "Can be used as relative anchors"
text: "Can be resized with different rules"
font: "text_bold"
id: "text"
parent: "root"
@@ -204,6 +204,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
nodes {
position {
@@ -230,6 +231,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
nodes {
position {
@@ -257,6 +259,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
nodes {
size {
@@ -279,6 +282,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
nodes {
position {
@@ -305,6 +309,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
nodes {
position {
@@ -331,6 +336,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
nodes {
position {
@@ -358,6 +364,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
nodes {
position {
@@ -384,6 +391,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
nodes {
position {
@@ -411,6 +419,7 @@ nodes {
z: 16.0
w: 16.0
}
alpha: 0.25
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -18,7 +18,7 @@ function M.get_examples()
root = "container_resize/root",
code_url = "example/examples/container/container_resize/container_resize.lua",
widget_class = require("example.examples.container.container_resize.container_resize"),
},
}
}
end

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

View File

@@ -212,6 +212,12 @@
"ui_example_panthera_animation_blend_description": "Here is a example of Panthera Animation Blend.",
"ui_example_panthera_animation_blend_hint": "Hover mouse over this area",
"ui_example_container_anchors": "Container: Anchors",
"ui_example_container_anchors_description": "Here is a example of container anchors.",
"ui_example_container_resize": "Container: Resize",
"ui_example_container_resize_description": "Here is a example of container resize.",
"ui_animation_vertical": "Vertical",
"ui_animation_horizontal": "Horizontal",