diff --git a/README.md b/README.md index 3bb00b7..a017811 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Open your `game.project` file and add the following lines to the dependencies fi **[Druid](https://github.com/Insality/druid/)** ``` -https://github.com/Insality/druid/archive/refs/tags/1.1.zip +https://github.com/Insality/druid/archive/refs/tags/1.1.0.zip ``` **[Defold Event](https://github.com/Insality/defold-event)** diff --git a/druid/editor_scripts/assign_layers.lua b/druid/editor_scripts/assign_layers.lua index da85492..8fe59d9 100644 --- a/druid/editor_scripts/assign_layers.lua +++ b/druid/editor_scripts/assign_layers.lua @@ -182,6 +182,9 @@ function M.assign_layers(gui_resource) name = layer_name, }) end + if #gui_data.layers == 0 then + gui_data.layers = nil + end -- Create a lookup table for faster matching - include both existing and new layers local layer_lookup = {} diff --git a/druid/widget/fps_panel/fps_panel.lua b/druid/widget/fps_panel/fps_panel.lua index 0ce5589..27827db 100644 --- a/druid/widget/fps_panel/fps_panel.lua +++ b/druid/widget/fps_panel/fps_panel.lua @@ -63,8 +63,8 @@ function M:update(dt) local current_time = socket.gettime() local delta_time = current_time - self.previous_time self.previous_time = current_time - self.collect_time_counter = self.collect_time_counter + delta_time + self.collect_time_counter = self.collect_time_counter + delta_time table.insert(self.fps_samples, 1, delta_time) while self.collect_time_counter > self.collect_time do diff --git a/example/examples/using_widgets/using_widgets.gui b/example/examples/using_widgets/using_widgets.gui index 3aa77c8..bfd24e8 100644 --- a/example/examples/using_widgets/using_widgets.gui +++ b/example/examples/using_widgets/using_widgets.gui @@ -13,106 +13,100 @@ textures { } nodes { position { - x: 861.0 - y: 545.0 + x: 960.0 + y: 540.0 } scale { - x: 3.0 - y: 3.0 + x: 2.0 + y: 2.0 } type: TYPE_TEMPLATE - id: "memory_panel" + id: "fps_panel" inherit_alpha: true - template: "/druid/widget/memory_panel/memory_panel.gui" + template: "/druid/widget/fps_panel/fps_panel.gui" } nodes { type: TYPE_BOX - id: "memory_panel/root" - parent: "memory_panel" + id: "fps_panel/root" + parent: "fps_panel" template_node_child: true } nodes { type: TYPE_TEMPLATE - id: "memory_panel/mini_graph" - parent: "memory_panel/root" + id: "fps_panel/mini_graph" + parent: "fps_panel/root" template_node_child: true } nodes { type: TYPE_BOX - id: "memory_panel/mini_graph/root" - parent: "memory_panel/mini_graph" + id: "fps_panel/mini_graph/root" + parent: "fps_panel/mini_graph" template_node_child: true } nodes { type: TYPE_BOX - id: "memory_panel/mini_graph/header" - parent: "memory_panel/mini_graph/root" + id: "fps_panel/mini_graph/header" + parent: "fps_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" + id: "fps_panel/mini_graph/text_header" + parent: "fps_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" + id: "fps_panel/mini_graph/icon_drag" + parent: "fps_panel/mini_graph/header" template_node_child: true } nodes { type: TYPE_BOX - id: "memory_panel/mini_graph/content" - parent: "memory_panel/mini_graph/root" + id: "fps_panel/mini_graph/content" + parent: "fps_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" + id: "fps_panel/mini_graph/prefab_line" + parent: "fps_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" + id: "fps_panel/mini_graph/color_low" + parent: "fps_panel/mini_graph/content" template_node_child: true } nodes { type: TYPE_BOX - id: "memory_panel/content" - parent: "memory_panel/root" + id: "fps_panel/content" + parent: "fps_panel/root" template_node_child: true } nodes { type: TYPE_TEXT - id: "memory_panel/text_max_value" - parent: "memory_panel/content" + id: "fps_panel/text_min_fps" + parent: "fps_panel/content" template_node_child: true } nodes { type: TYPE_TEXT - id: "memory_panel/text_per_second" - parent: "memory_panel/content" + id: "fps_panel/text_fps" + parent: "fps_panel/content" template_node_child: true } nodes { type: TYPE_BOX - id: "memory_panel/line_second_1" - parent: "memory_panel/content" + id: "fps_panel/line_second_1" + parent: "fps_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" + id: "fps_panel/line_second_2" + parent: "fps_panel/content" template_node_child: true } material: "/builtins/materials/gui.material" diff --git a/example/examples/using_widgets/using_widgets.gui_script b/example/examples/using_widgets/using_widgets.gui_script index 04961aa..e92405a 100644 --- a/example/examples/using_widgets/using_widgets.gui_script +++ b/example/examples/using_widgets/using_widgets.gui_script @@ -1,10 +1,10 @@ local druid = require("druid.druid") -local memory_panel = require("druid.widget.memory_panel.memory_panel") +local fps_panel = require("druid.widget.fps_panel.fps_panel") function init(self) self.druid = druid.new(self) - self.memory_panel = self.druid:new_widget(memory_panel, "memory_panel") + self.fps_panel = self.druid:new_widget(fps_panel, "fps_panel") end function final(self) diff --git a/wiki/changelog.md b/wiki/changelog.md index 6e2cdfd..83eddb1 100644 --- a/wiki/changelog.md +++ b/wiki/changelog.md @@ -674,6 +674,7 @@ Thank you for using Druid and please share your feedback! - **[Docs]** Add [CONTRIBUTING.md](https://github.com/Insality/druid/blob/develop/CONTRIBUTING.md) file with various information to help people to contribute to the Druid. - **[Editor Scripts]** Updated editor scripts - **[Editor Scripts]** Add "[Druid] Create Druid Widget" instead of "Create Custom Component" +- **[Editor Scripts]** Add "[Druid] Create Druid GUI Script" - **[Editor Scripts]** Add "[Druid] Settings" editor dialog - Contains different documentation links - You can adjust the widget template path to use your own templates in "Create Druid Widget" editor script