mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Tiling node to component, add way to move examples properties code to example itself
This commit is contained in:
@@ -15,14 +15,15 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 500.0
|
||||
y: 500.0
|
||||
x: 900.0
|
||||
y: 900.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "tiling_texture/pattern_0004"
|
||||
id: "tiling_node"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
alpha: 0.42
|
||||
material: "gui_tiling_node"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
|
@@ -5,7 +5,32 @@ local M = {}
|
||||
|
||||
|
||||
function M:init()
|
||||
self.tiling_node = self.druid:new_widget(tiling_node, nil, nil, self:get_node("tiling_node"))
|
||||
self.tiling_node = self.druid:new(tiling_node, self:get_node("tiling_node"))
|
||||
end
|
||||
|
||||
|
||||
---@param properties_panel properties_panel
|
||||
function M:properties_control(properties_panel)
|
||||
properties_panel:add_slider("Repeat X", 0, function(value)
|
||||
local repeat_x = math.floor(value * 10)
|
||||
self.tiling_node:set_repeat(repeat_x, nil)
|
||||
end)
|
||||
properties_panel:add_slider("Repeat Y", 0, function(value)
|
||||
local repeat_y = math.floor(value * 10)
|
||||
self.tiling_node:set_repeat(nil, repeat_y)
|
||||
end)
|
||||
properties_panel:add_slider("Offset X", 0, function(value)
|
||||
self.tiling_node:set_offset(value, nil)
|
||||
end)
|
||||
properties_panel:add_slider("Offset Y", 0, function(value)
|
||||
self.tiling_node:set_offset(nil, value)
|
||||
end)
|
||||
properties_panel:add_slider("Margin X", 0, function(value)
|
||||
self.tiling_node:set_margin(value, nil)
|
||||
end)
|
||||
properties_panel:add_slider("Margin Y", 0, function(value)
|
||||
self.tiling_node:set_margin(nil, value)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user