This commit is contained in:
Insality 2025-04-26 11:55:57 +03:00
parent ec39242fb1
commit 6d0a853d41
6 changed files with 42 additions and 44 deletions

View File

@ -39,7 +39,7 @@ Open your `game.project` file and add the following lines to the dependencies fi
**[Druid](https://github.com/Insality/druid/)** **[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)** **[Defold Event](https://github.com/Insality/defold-event)**

View File

@ -182,6 +182,9 @@ function M.assign_layers(gui_resource)
name = layer_name, name = layer_name,
}) })
end 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 -- Create a lookup table for faster matching - include both existing and new layers
local layer_lookup = {} local layer_lookup = {}

View File

@ -63,8 +63,8 @@ function M:update(dt)
local current_time = socket.gettime() local current_time = socket.gettime()
local delta_time = current_time - self.previous_time local delta_time = current_time - self.previous_time
self.previous_time = current_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) table.insert(self.fps_samples, 1, delta_time)
while self.collect_time_counter > self.collect_time do while self.collect_time_counter > self.collect_time do

View File

@ -13,106 +13,100 @@ textures {
} }
nodes { nodes {
position { position {
x: 861.0 x: 960.0
y: 545.0 y: 540.0
} }
scale { scale {
x: 3.0 x: 2.0
y: 3.0 y: 2.0
} }
type: TYPE_TEMPLATE type: TYPE_TEMPLATE
id: "memory_panel" id: "fps_panel"
inherit_alpha: true inherit_alpha: true
template: "/druid/widget/memory_panel/memory_panel.gui" template: "/druid/widget/fps_panel/fps_panel.gui"
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/root" id: "fps_panel/root"
parent: "memory_panel" parent: "fps_panel"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_TEMPLATE type: TYPE_TEMPLATE
id: "memory_panel/mini_graph" id: "fps_panel/mini_graph"
parent: "memory_panel/root" parent: "fps_panel/root"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/mini_graph/root" id: "fps_panel/mini_graph/root"
parent: "memory_panel/mini_graph" parent: "fps_panel/mini_graph"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/mini_graph/header" id: "fps_panel/mini_graph/header"
parent: "memory_panel/mini_graph/root" parent: "fps_panel/mini_graph/root"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_TEXT type: TYPE_TEXT
id: "memory_panel/mini_graph/text_header" id: "fps_panel/mini_graph/text_header"
parent: "memory_panel/mini_graph/header" parent: "fps_panel/mini_graph/header"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/mini_graph/icon_drag" id: "fps_panel/mini_graph/icon_drag"
parent: "memory_panel/mini_graph/header" parent: "fps_panel/mini_graph/header"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/mini_graph/content" id: "fps_panel/mini_graph/content"
parent: "memory_panel/mini_graph/root" parent: "fps_panel/mini_graph/root"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/mini_graph/prefab_line" id: "fps_panel/mini_graph/prefab_line"
parent: "memory_panel/mini_graph/content" parent: "fps_panel/mini_graph/content"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/mini_graph/color_low" id: "fps_panel/mini_graph/color_low"
parent: "memory_panel/mini_graph/content" parent: "fps_panel/mini_graph/content"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/content" id: "fps_panel/content"
parent: "memory_panel/root" parent: "fps_panel/root"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_TEXT type: TYPE_TEXT
id: "memory_panel/text_max_value" id: "fps_panel/text_min_fps"
parent: "memory_panel/content" parent: "fps_panel/content"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_TEXT type: TYPE_TEXT
id: "memory_panel/text_per_second" id: "fps_panel/text_fps"
parent: "memory_panel/content" parent: "fps_panel/content"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/line_second_1" id: "fps_panel/line_second_1"
parent: "memory_panel/content" parent: "fps_panel/content"
template_node_child: true template_node_child: true
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "memory_panel/line_second_2" id: "fps_panel/line_second_2"
parent: "memory_panel/content" parent: "fps_panel/content"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "memory_panel/text_memory"
parent: "memory_panel/content"
template_node_child: true template_node_child: true
} }
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"

View File

@ -1,10 +1,10 @@
local druid = require("druid.druid") 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) function init(self)
self.druid = druid.new(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 end
function final(self) function final(self)

View File

@ -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. - **[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]** Updated editor scripts
- **[Editor Scripts]** Add "[Druid] Create Druid Widget" instead of "Create Custom Component" - **[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 - **[Editor Scripts]** Add "[Druid] Settings" editor dialog
- Contains different documentation links - Contains different documentation links
- You can adjust the widget template path to use your own templates in "Create Druid Widget" editor script - You can adjust the widget template path to use your own templates in "Create Druid Widget" editor script