mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Update
This commit is contained in:
@@ -177,6 +177,37 @@ function M.get_examples()
|
||||
end
|
||||
end)
|
||||
end,
|
||||
},
|
||||
{
|
||||
name_id = "ui_example_widget_tiling_node",
|
||||
information_text_id = "ui_example_widget_tiling_node_description",
|
||||
template = "example_tiling_node",
|
||||
root = "example_tiling_node/root",
|
||||
code_url = "example/examples/widgets/tiling_node/example_tiling_node.lua",
|
||||
widget_class = require("example.examples.widgets.tiling_node.example_tiling_node"),
|
||||
properties_control = function(instance, properties_panel)
|
||||
---@cast instance examples.example_tiling_node
|
||||
properties_panel:add_slider("Repeat X", 0, function(value)
|
||||
local repeat_x = math.floor(value * 10)
|
||||
instance.tiling_node:refresh(repeat_x, nil)
|
||||
end)
|
||||
properties_panel:add_slider("Repeat Y", 0, function(value)
|
||||
local repeat_y = math.floor(value * 10)
|
||||
instance.tiling_node:refresh(nil, repeat_y)
|
||||
end)
|
||||
properties_panel:add_slider("Offset X", 0, function(value)
|
||||
instance.tiling_node:set_offset(value, nil)
|
||||
end)
|
||||
properties_panel:add_slider("Offset Y", 0, function(value)
|
||||
instance.tiling_node:set_offset(nil, value)
|
||||
end)
|
||||
properties_panel:add_slider("Margin X", 0, function(value)
|
||||
instance.tiling_node:set_margin(value, nil)
|
||||
end)
|
||||
properties_panel:add_slider("Margin Y", 0, function(value)
|
||||
instance.tiling_node:set_margin(nil, value)
|
||||
end)
|
||||
end,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
33
example/examples/widgets/tiling_node/example_tiling_node.gui
Normal file
33
example/examples/widgets/tiling_node/example_tiling_node.gui
Normal file
@@ -0,0 +1,33 @@
|
||||
textures {
|
||||
name: "tiling_texture"
|
||||
texture: "/example/examples/widgets/tiling_node/tiling_texture.atlas"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 200.0
|
||||
y: 100.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "root"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 500.0
|
||||
y: 500.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "tiling_texture/pattern_0004"
|
||||
id: "tiling_node"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
material: "gui_tiling_node"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
materials {
|
||||
name: "gui_tiling_node"
|
||||
material: "/druid/materials/gui_tiling_node/gui_tiling_node.material"
|
||||
}
|
12
example/examples/widgets/tiling_node/example_tiling_node.lua
Normal file
12
example/examples/widgets/tiling_node/example_tiling_node.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local tiling_node = require("druid.widget.tiling_node.tiling_node")
|
||||
|
||||
---@class examples.example_tiling_node: druid.widget
|
||||
local M = {}
|
||||
|
||||
|
||||
function M:init()
|
||||
self.tiling_node = self.druid:new_widget(tiling_node, nil, nil, self:get_node("tiling_node"))
|
||||
end
|
||||
|
||||
|
||||
return M
|
BIN
example/examples/widgets/tiling_node/pattern_0004.png
Normal file
BIN
example/examples/widgets/tiling_node/pattern_0004.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,3 @@
|
||||
images {
|
||||
image: "/example/examples/widgets/tiling_node/pattern_0004.png"
|
||||
}
|
Reference in New Issue
Block a user