mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Widgets WIP
This commit is contained in:
@@ -14,14 +14,13 @@ nodes {
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
pivot: PIVOT_NW
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -20.0
|
||||
x: -200.0
|
||||
}
|
||||
scale {
|
||||
x: 0.65
|
||||
@@ -58,8 +57,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 267.0
|
||||
y: -20.0
|
||||
x: 200.0
|
||||
}
|
||||
size {
|
||||
x: 226.0
|
||||
@@ -73,6 +71,7 @@ nodes {
|
||||
type: TYPE_BOX
|
||||
texture: "druid/rect_round2_width2"
|
||||
id: "button"
|
||||
pivot: PIVOT_E
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
@@ -84,6 +83,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -113.0
|
||||
y: -20.0
|
||||
}
|
||||
size {
|
||||
@@ -104,6 +104,9 @@ nodes {
|
||||
inherit_alpha: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -113.0
|
||||
}
|
||||
scale {
|
||||
x: 0.65
|
||||
y: 0.65
|
||||
|
@@ -1,5 +1,6 @@
|
||||
---@class property_button: druid.widget
|
||||
---@field root node
|
||||
---@field container druid.container
|
||||
---@field text_name druid.text
|
||||
---@field button druid.button
|
||||
---@field text_button druid.text
|
||||
@@ -18,6 +19,10 @@ function M:init(template, nodes)
|
||||
|
||||
self.button = self.druid:new_button("button", self.on_click)
|
||||
self.text_button = self.druid:new_text("text_button")
|
||||
|
||||
self.container = self.druid:new_container(self.root)
|
||||
self.container:add_container("text_name")
|
||||
self.container:add_container("button")
|
||||
end
|
||||
|
||||
|
||||
|
@@ -14,14 +14,13 @@ nodes {
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
pivot: PIVOT_NW
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -20.0
|
||||
x: -200.0
|
||||
}
|
||||
scale {
|
||||
x: 0.65
|
||||
@@ -58,8 +57,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 174.0
|
||||
y: -20.0
|
||||
x: -20.0
|
||||
}
|
||||
size {
|
||||
x: 40.0
|
||||
|
@@ -22,6 +22,10 @@ function M:init(template, nodes)
|
||||
self.text_name = self.druid:new_lang_text("text_name")
|
||||
|
||||
self.button = self.druid:new_button("button", self.on_click)
|
||||
|
||||
self.container = self.druid:new_container(self.root)
|
||||
self.container:add_container("text_name")
|
||||
self.container:add_container("button")
|
||||
end
|
||||
|
||||
|
||||
|
@@ -14,14 +14,13 @@ nodes {
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
pivot: PIVOT_NW
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -20.0
|
||||
x: -200.0
|
||||
}
|
||||
scale {
|
||||
x: 0.65
|
||||
@@ -58,11 +57,10 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 234.0
|
||||
y: -20.0
|
||||
x: 40.0
|
||||
}
|
||||
size {
|
||||
x: 160.0
|
||||
x: 190.0
|
||||
y: 40.0
|
||||
}
|
||||
color {
|
||||
@@ -78,7 +76,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 160.0
|
||||
x: 166.0
|
||||
y: 8.0
|
||||
}
|
||||
color {
|
||||
@@ -100,7 +98,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -68.0
|
||||
x: -83.0
|
||||
}
|
||||
size {
|
||||
x: 24.0
|
||||
@@ -125,8 +123,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 380.0
|
||||
y: -20.0
|
||||
x: 200.0
|
||||
}
|
||||
size {
|
||||
x: 60.0
|
||||
|
@@ -1,5 +1,6 @@
|
||||
---@class property_slider: druid.widget
|
||||
---@field root node
|
||||
---@field container druid.container
|
||||
---@field druid druid_instance
|
||||
---@field text_name druid.lang_text
|
||||
---@field text_value druid.text
|
||||
@@ -19,12 +20,17 @@ function M:init(template, nodes)
|
||||
|
||||
self.text_name = self.druid:new_lang_text("text_name") --[[@as druid.lang_text]]
|
||||
self.text_value = self.druid:new_text("text_value")
|
||||
self.slider = self.druid:new_slider("slider_pin", vmath.vector3(68, 0, 0), self._on_slider_change_by_user) --[[@as druid.slider]]
|
||||
self.slider = self.druid:new_slider("slider_pin", vmath.vector3(183, 0, 0), self._on_slider_change_by_user) --[[@as druid.slider]]
|
||||
self.slider:set_input_node("slider")
|
||||
|
||||
self:set_text_function(function(value)
|
||||
return math.floor(value * 100) .. "%"
|
||||
end)
|
||||
|
||||
self.container = self.druid:new_container(self.root)
|
||||
self.container:add_container("text_name")
|
||||
self.container:add_container("slider")
|
||||
self.container:add_container("button")
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user