From 4ef65579a638e2122cf513fe260db84cd140096a Mon Sep 17 00:00:00 2001 From: Insality Date: Thu, 21 Nov 2024 00:18:43 +0200 Subject: [PATCH] Update --- druid/widget/fps_panel/fps_panel.lua | 5 + druid/widget/memory_panel/memory_panel.lua | 5 + druid/widget/mini_graph/mini_graph.lua | 15 +- .../properties/property_button.gui | 4 +- .../properties/property_checkbox.gui | 2 +- .../property_left_right_selector.lua | 3 + .../properties_panel/properties_panel.lua | 5 + example/druid.gui | 369 +++++++++++++++++- example/examples/widgets/examples_list.lua | 8 + .../example_properties_panel.gui | 368 +++++++++++++++++ .../example_properties_panel.lua | 38 ++ game.project | 1 + 12 files changed, 817 insertions(+), 6 deletions(-) create mode 100644 example/examples/widgets/properties_panel/example_properties_panel.gui create mode 100644 example/examples/widgets/properties_panel/example_properties_panel.lua diff --git a/druid/widget/fps_panel/fps_panel.lua b/druid/widget/fps_panel/fps_panel.lua index 1b0edaa..33a2d99 100644 --- a/druid/widget/fps_panel/fps_panel.lua +++ b/druid/widget/fps_panel/fps_panel.lua @@ -33,6 +33,11 @@ function M:init() end +function M:on_remove() + timer.cancel(self.timer_id) +end + + function M:update(dt) if not self.previous_time then self.previous_time = socket.gettime() diff --git a/druid/widget/memory_panel/memory_panel.lua b/druid/widget/memory_panel/memory_panel.lua index 213a3e5..e90aeec 100644 --- a/druid/widget/memory_panel/memory_panel.lua +++ b/druid/widget/memory_panel/memory_panel.lua @@ -28,6 +28,11 @@ function M:init() end +function M:on_remove() + timer.cancel(self.timer_id) +end + + function M:set_low_memory_limit(limit) self.memory_limit = limit end diff --git a/druid/widget/mini_graph/mini_graph.lua b/druid/widget/mini_graph/mini_graph.lua index cf266fc..f8cff1e 100644 --- a/druid/widget/mini_graph/mini_graph.lua +++ b/druid/widget/mini_graph/mini_graph.lua @@ -39,13 +39,24 @@ function M:init() end -function M:set_samples(samples) - self.samples = samples +function M:on_remove() + self:clear() +end + + +function M:clear() self.layout:clear_layout() for index = 1, #self.lines do gui.delete_node(self.lines[index]) end + self.lines = {} +end + + +function M:set_samples(samples) + self.samples = samples + self:clear() local line_width = self.layout:get_size().x / self.samples for index = 1, self.samples do diff --git a/druid/widget/properties_panel/properties/property_button.gui b/druid/widget/properties_panel/properties/property_button.gui index 2175a1c..a7e55c8 100644 --- a/druid/widget/properties_panel/properties/property_button.gui +++ b/druid/widget/properties_panel/properties/property_button.gui @@ -37,7 +37,7 @@ nodes { } type: TYPE_TEXT text: "Button" - font: "text_bold" + font: "druid_text_bold" id: "text_name" pivot: PIVOT_W outline { @@ -134,7 +134,7 @@ nodes { } type: TYPE_TEXT text: "Button" - font: "text_bold" + font: "druid_text_bold" id: "text_button" outline { x: 1.0 diff --git a/druid/widget/properties_panel/properties/property_checkbox.gui b/druid/widget/properties_panel/properties/property_checkbox.gui index 80740ca..aeb1180 100644 --- a/druid/widget/properties_panel/properties/property_checkbox.gui +++ b/druid/widget/properties_panel/properties/property_checkbox.gui @@ -37,7 +37,7 @@ nodes { } type: TYPE_TEXT text: "Checkbox" - font: "text_bold" + font: "druid_text_bold" id: "text_name" pivot: PIVOT_W outline { diff --git a/druid/widget/properties_panel/properties/property_left_right_selector.lua b/druid/widget/properties_panel/properties/property_left_right_selector.lua index deae880..2065663 100644 --- a/druid/widget/properties_panel/properties/property_left_right_selector.lua +++ b/druid/widget/properties_panel/properties/property_left_right_selector.lua @@ -20,7 +20,10 @@ function M:init() self.text_value = self.druid:new_text("text_value") self.button_left = self.druid:new_button("button_left", self.on_button_left) + self.button_left.on_repeated_click:subscribe(self.on_button_left, self) + self.button_right = self.druid:new_button("button_right", self.on_button_right) + self.button_right.on_repeated_click:subscribe(self.on_button_right, self) self.on_change_value = event.create() diff --git a/druid/widget/properties_panel/properties_panel.lua b/druid/widget/properties_panel/properties_panel.lua index a8f9da2..93227c5 100644 --- a/druid/widget/properties_panel/properties_panel.lua +++ b/druid/widget/properties_panel/properties_panel.lua @@ -75,6 +75,11 @@ function M:init() end +function M:on_remove() + self:clear() +end + + function M:on_drag_widget(dx, dy) local position = self.container:get_position() self.container:set_position(position.x + dx, position.y + dy) diff --git a/example/druid.gui b/example/druid.gui index fa7360f..8e1b2ea 100644 --- a/example/druid.gui +++ b/example/druid.gui @@ -4128,6 +4128,373 @@ nodes { parent: "example_fps_panel/fps_panel/content" template_node_child: true } +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel" + parent: "widgets" + inherit_alpha: true + template: "/example/examples/widgets/properties_panel/example_properties_panel.gui" +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/root" + parent: "example_properties_panel" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel/properties_panel" + parent: "example_properties_panel/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/root" + parent: "example_properties_panel/properties_panel" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/header" + parent: "example_properties_panel/properties_panel/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/text_header" + parent: "example_properties_panel/properties_panel/header" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/icon_drag" + parent: "example_properties_panel/properties_panel/header" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/content" + parent: "example_properties_panel/properties_panel/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/scroll_view" + parent: "example_properties_panel/properties_panel/content" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/scroll_content" + parent: "example_properties_panel/properties_panel/scroll_view" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/propeties" + parent: "example_properties_panel/properties_panel/content" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel/properties_panel/property_slider" + parent: "example_properties_panel/properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_slider/root" + parent: "example_properties_panel/properties_panel/property_slider" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_slider/text_name" + parent: "example_properties_panel/properties_panel/property_slider/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_slider/E_Anchor" + parent: "example_properties_panel/properties_panel/property_slider/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_slider/slider" + parent: "example_properties_panel/properties_panel/property_slider/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_slider/slider_back" + parent: "example_properties_panel/properties_panel/property_slider/slider" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_slider/slider_pin" + parent: "example_properties_panel/properties_panel/property_slider/slider" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_slider/button" + parent: "example_properties_panel/properties_panel/property_slider/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_slider/selected" + parent: "example_properties_panel/properties_panel/property_slider/button" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_slider/text_value" + parent: "example_properties_panel/properties_panel/property_slider/button" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel/properties_panel/property_checkbox" + parent: "example_properties_panel/properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_checkbox/root" + parent: "example_properties_panel/properties_panel/property_checkbox" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_checkbox/text_name" + parent: "example_properties_panel/properties_panel/property_checkbox/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_checkbox/E_Anchor" + parent: "example_properties_panel/properties_panel/property_checkbox/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_checkbox/button" + parent: "example_properties_panel/properties_panel/property_checkbox/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_checkbox/icon" + parent: "example_properties_panel/properties_panel/property_checkbox/button" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_checkbox/selected" + parent: "example_properties_panel/properties_panel/property_checkbox/button" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel/properties_panel/property_button" + parent: "example_properties_panel/properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_button/root" + parent: "example_properties_panel/properties_panel/property_button" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_button/text_name" + parent: "example_properties_panel/properties_panel/property_button/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_button/E_Anchor" + parent: "example_properties_panel/properties_panel/property_button/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_button/button" + parent: "example_properties_panel/properties_panel/property_button/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_button/selected" + parent: "example_properties_panel/properties_panel/property_button/button" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_button/text_button" + parent: "example_properties_panel/properties_panel/property_button/button" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel/properties_panel/property_input" + parent: "example_properties_panel/properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_input/root" + parent: "example_properties_panel/properties_panel/property_input" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_input/text_name" + parent: "example_properties_panel/properties_panel/property_input/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_input/E_Anchor" + parent: "example_properties_panel/properties_panel/property_input/root" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel/properties_panel/property_input/rich_input" + parent: "example_properties_panel/properties_panel/property_input/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_input/rich_input/root" + parent: "example_properties_panel/properties_panel/property_input/rich_input" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_input/rich_input/button" + parent: "example_properties_panel/properties_panel/property_input/rich_input/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_input/rich_input/placeholder_text" + parent: "example_properties_panel/properties_panel/property_input/rich_input/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_input/rich_input/input_text" + parent: "example_properties_panel/properties_panel/property_input/rich_input/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_input/rich_input/cursor_node" + parent: "example_properties_panel/properties_panel/property_input/rich_input/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_input/rich_input/cursor_text" + parent: "example_properties_panel/properties_panel/property_input/rich_input/cursor_node" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_input/selected" + parent: "example_properties_panel/properties_panel/property_input/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel/properties_panel/property_text" + parent: "example_properties_panel/properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_text/root" + parent: "example_properties_panel/properties_panel/property_text" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_text/text_name" + parent: "example_properties_panel/properties_panel/property_text/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_text/text_right" + parent: "example_properties_panel/properties_panel/property_text/root" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "example_properties_panel/properties_panel/property_left_right_selector" + parent: "example_properties_panel/properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_left_right_selector/root" + parent: "example_properties_panel/properties_panel/property_left_right_selector" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_left_right_selector/text_name" + parent: "example_properties_panel/properties_panel/property_left_right_selector/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_left_right_selector/E_Anchor" + parent: "example_properties_panel/properties_panel/property_left_right_selector/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_left_right_selector/button_left" + parent: "example_properties_panel/properties_panel/property_left_right_selector/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_left_right_selector/icon_left" + parent: "example_properties_panel/properties_panel/property_left_right_selector/button_left" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_left_right_selector/button_right" + parent: "example_properties_panel/properties_panel/property_left_right_selector/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_left_right_selector/icon_right" + parent: "example_properties_panel/properties_panel/property_left_right_selector/button_right" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "example_properties_panel/properties_panel/property_left_right_selector/selected" + parent: "example_properties_panel/properties_panel/property_left_right_selector/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "example_properties_panel/properties_panel/property_left_right_selector/text_value" + parent: "example_properties_panel/properties_panel/property_left_right_selector/E_Anchor" + template_node_child: true +} nodes { position { x: -20.0 @@ -4260,4 +4627,4 @@ layers { } material: "/builtins/materials/gui.material" adjust_reference: ADJUST_REFERENCE_PARENT -max_nodes: 2048 +max_nodes: 4096 diff --git a/example/examples/widgets/examples_list.lua b/example/examples/widgets/examples_list.lua index 257090a..14c7728 100644 --- a/example/examples/widgets/examples_list.lua +++ b/example/examples/widgets/examples_list.lua @@ -69,6 +69,14 @@ function M.get_examples() code_url = "example/examples/widgets/fps_panel/example_fps_panel.lua", widget_class = require("example.examples.widgets.fps_panel.example_fps_panel"), }, + { + name_id = "ui_example_widget_properties_panel", + information_text_id = "ui_example_widget_properties_panel_description", + template = "example_properties_panel", + root = "example_properties_panel/root", + code_url = "example/examples/widgets/properties_panel/example_properties_panel.lua", + widget_class = require("example.examples.widgets.properties_panel.example_properties_panel"), + }, } end diff --git a/example/examples/widgets/properties_panel/example_properties_panel.gui b/example/examples/widgets/properties_panel/example_properties_panel.gui new file mode 100644 index 0000000..b1889c7 --- /dev/null +++ b/example/examples/widgets/properties_panel/example_properties_panel.gui @@ -0,0 +1,368 @@ +nodes { + size { + x: 200.0 + y: 100.0 + } + type: TYPE_BOX + id: "root" + inherit_alpha: true + size_mode: SIZE_MODE_AUTO + visible: false +} +nodes { + type: TYPE_TEMPLATE + id: "properties_panel" + parent: "root" + inherit_alpha: true + template: "/druid/widget/properties_panel/properties_panel.gui" +} +nodes { + type: TYPE_BOX + id: "properties_panel/root" + parent: "properties_panel" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/header" + parent: "properties_panel/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/text_header" + parent: "properties_panel/header" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/icon_drag" + parent: "properties_panel/header" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/content" + parent: "properties_panel/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/scroll_view" + parent: "properties_panel/content" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/scroll_content" + parent: "properties_panel/scroll_view" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/propeties" + parent: "properties_panel/content" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "properties_panel/property_slider" + parent: "properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_slider/root" + parent: "properties_panel/property_slider" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_slider/text_name" + parent: "properties_panel/property_slider/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_slider/E_Anchor" + parent: "properties_panel/property_slider/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_slider/slider" + parent: "properties_panel/property_slider/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_slider/slider_back" + parent: "properties_panel/property_slider/slider" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_slider/slider_pin" + parent: "properties_panel/property_slider/slider" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_slider/button" + parent: "properties_panel/property_slider/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_slider/selected" + parent: "properties_panel/property_slider/button" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_slider/text_value" + parent: "properties_panel/property_slider/button" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "properties_panel/property_checkbox" + parent: "properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_checkbox/root" + parent: "properties_panel/property_checkbox" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_checkbox/text_name" + parent: "properties_panel/property_checkbox/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_checkbox/E_Anchor" + parent: "properties_panel/property_checkbox/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_checkbox/button" + parent: "properties_panel/property_checkbox/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_checkbox/icon" + parent: "properties_panel/property_checkbox/button" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_checkbox/selected" + parent: "properties_panel/property_checkbox/button" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "properties_panel/property_button" + parent: "properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_button/root" + parent: "properties_panel/property_button" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_button/text_name" + parent: "properties_panel/property_button/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_button/E_Anchor" + parent: "properties_panel/property_button/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_button/button" + parent: "properties_panel/property_button/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_button/selected" + parent: "properties_panel/property_button/button" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_button/text_button" + parent: "properties_panel/property_button/button" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "properties_panel/property_input" + parent: "properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_input/root" + parent: "properties_panel/property_input" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_input/text_name" + parent: "properties_panel/property_input/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_input/E_Anchor" + parent: "properties_panel/property_input/root" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "properties_panel/property_input/rich_input" + parent: "properties_panel/property_input/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_input/rich_input/root" + parent: "properties_panel/property_input/rich_input" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_input/rich_input/button" + parent: "properties_panel/property_input/rich_input/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_input/rich_input/placeholder_text" + parent: "properties_panel/property_input/rich_input/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_input/rich_input/input_text" + parent: "properties_panel/property_input/rich_input/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_input/rich_input/cursor_node" + parent: "properties_panel/property_input/rich_input/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_input/rich_input/cursor_text" + parent: "properties_panel/property_input/rich_input/cursor_node" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_input/selected" + parent: "properties_panel/property_input/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "properties_panel/property_text" + parent: "properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_text/root" + parent: "properties_panel/property_text" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_text/text_name" + parent: "properties_panel/property_text/root" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_text/text_right" + parent: "properties_panel/property_text/root" + template_node_child: true +} +nodes { + type: TYPE_TEMPLATE + id: "properties_panel/property_left_right_selector" + parent: "properties_panel/propeties" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_left_right_selector/root" + parent: "properties_panel/property_left_right_selector" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_left_right_selector/text_name" + parent: "properties_panel/property_left_right_selector/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_left_right_selector/E_Anchor" + parent: "properties_panel/property_left_right_selector/root" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_left_right_selector/button_left" + parent: "properties_panel/property_left_right_selector/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_left_right_selector/icon_left" + parent: "properties_panel/property_left_right_selector/button_left" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_left_right_selector/button_right" + parent: "properties_panel/property_left_right_selector/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_left_right_selector/icon_right" + parent: "properties_panel/property_left_right_selector/button_right" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/property_left_right_selector/selected" + parent: "properties_panel/property_left_right_selector/E_Anchor" + template_node_child: true +} +nodes { + type: TYPE_TEXT + id: "properties_panel/property_left_right_selector/text_value" + parent: "properties_panel/property_left_right_selector/E_Anchor" + template_node_child: true +} +material: "/builtins/materials/gui.material" +adjust_reference: ADJUST_REFERENCE_PARENT diff --git a/example/examples/widgets/properties_panel/example_properties_panel.lua b/example/examples/widgets/properties_panel/example_properties_panel.lua new file mode 100644 index 0000000..f892909 --- /dev/null +++ b/example/examples/widgets/properties_panel/example_properties_panel.lua @@ -0,0 +1,38 @@ +local properties_panel = require("druid.widget.properties_panel.properties_panel") + +---@class widget.example_properties_panel: druid.widget +local M = {} + + +function M:init() + self.properties_panel = self.druid:new_widget(properties_panel, "properties_panel") + + self.properties_panel:add_button("Button", function() + print("Button clicked") + end) + + self.properties_panel:add_checkbox("Checkbox", false, function(value) + print("Checkbox clicked", value) + end) + + self.properties_panel:add_input("Input", "Initial", function(value) + print("Input value", value) + end) + + self.properties_panel:add_left_right_selector("Arrows Number", 0, function(value) + print("Left Right Number value", value) + end):set_number_type(0, 42, true, 1) + + self.properties_panel:add_left_right_selector("Arrows Array", "Zero", function(value) + print("Left Right Array value", value) + end):set_array_type({"Zero", "One", "Two", "Three", "Four", "Five"}, false, 1) + + self.properties_panel:add_slider("Slider", 0.5, function(value) + print("Slider value", value) + end) + + self.properties_panel:add_text("Text", "Some text") +end + + +return M \ No newline at end of file diff --git a/game.project b/game.project index 5aebe16..e233e1c 100644 --- a/game.project +++ b/game.project @@ -24,6 +24,7 @@ dependencies#2 = https://github.com/Insality/defold-tweener/archive/refs/tags/3. dependencies#3 = https://github.com/Insality/panthera/archive/refs/tags/runtime.4.zip dependencies#4 = https://github.com/Insality/defold-lang/archive/refs/tags/3.zip dependencies#5 = https://github.com/Insality/defold-event/archive/refs/tags/10.zip +dependencies#6 = https://github.com/subsoap/defos/archive/refs/tags/v2.8.0.zip [library] include_dirs = druid