mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update docs, add Editor script: Create Druid GUI Script, add simple using widgets example
This commit is contained in:
@@ -57,7 +57,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 118.0
|
||||
y: -118.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "slider/slider_pin"
|
||||
|
@@ -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")
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
10
example/examples/using_widgets/using_widgets.collection
Normal file
10
example/examples/using_widgets/using_widgets.collection
Normal 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"
|
||||
""
|
||||
}
|
119
example/examples/using_widgets/using_widgets.gui
Normal file
119
example/examples/using_widgets/using_widgets.gui
Normal 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
|
25
example/examples/using_widgets/using_widgets.gui_script
Normal file
25
example/examples/using_widgets/using_widgets.gui_script
Normal 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
|
Reference in New Issue
Block a user