Update the panel druid profiler, remove events counter

This commit is contained in:
Insality 2025-01-30 19:30:56 +02:00
parent 0514625f9a
commit b6c0e1556a
4 changed files with 41 additions and 156 deletions

View File

@ -17,10 +17,25 @@ nodes {
z: 0.157 z: 0.157
} }
type: TYPE_BOX type: TYPE_BOX
texture: "druid_example/pixel"
id: "root" id: "root"
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
inherit_alpha: true inherit_alpha: true
} }
nodes {
size {
x: 1040.0
y: 50.0
}
type: TYPE_BOX
id: "layout"
xanchor: XANCHOR_LEFT
adjust_mode: ADJUST_MODE_STRETCH
parent: "root"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
visible: false
}
nodes { nodes {
position { position {
x: -530.0 x: -530.0
@ -32,7 +47,7 @@ nodes {
type: TYPE_BOX type: TYPE_BOX
id: "group_memory" id: "group_memory"
pivot: PIVOT_W pivot: PIVOT_W
parent: "root" parent: "layout"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@ -149,7 +164,7 @@ nodes {
} }
nodes { nodes {
position { position {
x: -130.0 x: -31.0
} }
size { size {
x: 16.0 x: 16.0
@ -158,7 +173,7 @@ nodes {
type: TYPE_BOX type: TYPE_BOX
texture: "druid_example/empty" texture: "druid_example/empty"
id: "group_fps" id: "group_fps"
parent: "root" parent: "layout"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@ -279,7 +294,7 @@ nodes {
} }
nodes { nodes {
position { position {
x: 130.0 x: 355.0
} }
size { size {
x: 16.0 x: 16.0
@ -288,7 +303,7 @@ nodes {
type: TYPE_BOX type: TYPE_BOX
texture: "druid_example/empty" texture: "druid_example/empty"
id: "group_components" id: "group_components"
parent: "root" parent: "layout"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@ -366,95 +381,6 @@ nodes {
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
} }
nodes {
position {
x: 530.0
}
size {
x: 16.0
y: 50.0
}
type: TYPE_BOX
id: "group_events"
pivot: PIVOT_E
parent: "root"
inherit_alpha: true
visible: false
}
nodes {
position {
x: -163.0
}
scale {
x: 0.8
y: 0.8
}
size {
x: 200.0
y: 50.0
}
color {
x: 0.306
y: 0.31
z: 0.314
}
type: TYPE_TEXT
text: "Events"
font: "text_bold"
id: "text_events"
outline {
x: 1.0
y: 1.0
z: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
}
parent: "group_events"
layer: "text_bold"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
nodes {
position {
x: -59.0
}
scale {
x: 0.8
y: 0.8
}
size {
x: 200.0
y: 50.0
}
color {
x: 0.463
y: 0.475
z: 0.49
}
type: TYPE_TEXT
text: "6000"
font: "text_bold"
id: "text_events_amount"
outline {
x: 1.0
y: 1.0
z: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
}
parent: "group_events"
layer: "text_bold"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
layers { layers {
name: "druid" name: "druid"
} }

View File

@ -18,25 +18,30 @@ function M:init(template, nodes)
self.group_memory = self.root:add_container("group_memory") self.group_memory = self.root:add_container("group_memory")
self.group_fps = self.root:add_container("group_fps") self.group_fps = self.root:add_container("group_fps")
self.group_components = self.root:add_container("group_components") self.group_components = self.root:add_container("group_components")
self.group_events = self.root:add_container("group_events")
self.root:add_container("layout", nil, function()
self.layout:set_dirty()
end)
self.layout = self.druid:new_layout("layout", "horizontal")
self.layout:add(self.group_memory.node)
self.layout:add(self.group_fps.node)
self.layout:add(self.group_components.node)
self.layout:set_justify(true)
self.druid:new_button("group_memory", self.run_collectgarbage) self.druid:new_button("group_memory", self.run_collectgarbage)
self.group_memory:set_min_size(270, nil) self.group_memory:set_min_size(270, nil)
self.group_fps:set_min_size(270, nil) self.group_fps:set_min_size(270, nil)
self.group_components:set_min_size(270, nil) self.group_components:set_min_size(270, nil)
self.group_events:set_min_size(270, nil)
self.text_memory_amount = self.druid:new_text("text_memory_amount") self.text_memory_amount = self.druid:new_text("text_memory_amount")
self.text_fps_amount = self.druid:new_text("text_fps_amount") self.text_fps_amount = self.druid:new_text("text_fps_amount")
self.text_fps_min = self.druid:new_text("text_fps_min") self.text_fps_min = self.druid:new_text("text_fps_min")
self.text_components_amount = self.druid:new_text("text_components_amount") self.text_components_amount = self.druid:new_text("text_components_amount")
self.text_events_amount = self.druid:new_text("text_events_amount")
self.druid:new_lang_text("text_memory", "ui_profiler_memory") self.druid:new_lang_text("text_memory", "ui_profiler_memory")
self.druid:new_lang_text("text_fps", "ui_profiler_fps") self.druid:new_lang_text("text_fps", "ui_profiler_fps")
self.druid:new_lang_text("text_components", "ui_profiler_components") self.druid:new_lang_text("text_components", "ui_profiler_components")
self.druid:new_lang_text("text_events", "ui_profiler_events")
self.previous_time = nil self.previous_time = nil
self.fps_samples = {} self.fps_samples = {}
@ -55,17 +60,12 @@ function M:init(template, nodes)
self:get_node("text_components"), self:get_node("text_components"),
self:get_node("text_components_amount"), self:get_node("text_components_amount"),
} }
self.nodes_events = {
self:get_node("text_events"),
self:get_node("text_events_amount"),
}
timer.delay(0.16, true, function() timer.delay(0.16, true, function()
self:update_memory() self:update_memory()
self:update_fps() self:update_fps()
self:update_components() self:update_components()
self:update_events() self.layout:set_dirty()
self:align_fps_components()
end) end)
end end
@ -74,8 +74,7 @@ function M:on_language_change()
self:update_memory() self:update_memory()
self:update_fps() self:update_fps()
self:update_components() self:update_components()
self:update_events() self.layout:set_dirty()
self:align_fps_components()
end end
@ -120,34 +119,6 @@ function M:update_components()
end end
function M:update_events()
self.text_events_amount:set_text("unsupported")
local width = helper.centrate_nodes(2, unpack(self.nodes_events))
for index = 1, #self.nodes_events do
local node = self.nodes_events[index]
local position_x = gui.get(node, "position.x")
gui.set(node, "position.x", position_x - width/2)
end
self.group_events:set_size(width, nil)
end
function M:align_fps_components()
local pos_x_memory = gui.get(self.group_memory.node, "position.x") + gui.get(self.group_memory.node, "size.x")
local pos_x_events = gui.get(self.group_events.node, "position.x") - gui.get(self.group_events.node, "size.x")
local width = pos_x_events - pos_x_memory
-- Align FPS and Components
local fps_size = gui.get(self.group_fps.node, "size.x")
local components_size = gui.get(self.group_components.node, "size.x")
local free_width = width - fps_size - components_size
gui.set(self.group_fps.node, "position.x", pos_x_memory + fps_size/2 + free_width/3)
gui.set(self.group_components.node, "position.x", pos_x_events - components_size/2 - free_width/3)
end
function M:update() function M:update()
self:sample_fps() self:sample_fps()
end end

View File

@ -4824,10 +4824,16 @@ nodes {
} }
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "panel_druid_profiler/group_memory" id: "panel_druid_profiler/layout"
parent: "panel_druid_profiler/root" parent: "panel_druid_profiler/root"
template_node_child: true template_node_child: true
} }
nodes {
type: TYPE_BOX
id: "panel_druid_profiler/group_memory"
parent: "panel_druid_profiler/layout"
template_node_child: true
}
nodes { nodes {
type: TYPE_TEXT type: TYPE_TEXT
id: "panel_druid_profiler/text_memory" id: "panel_druid_profiler/text_memory"
@ -4849,7 +4855,7 @@ nodes {
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "panel_druid_profiler/group_fps" id: "panel_druid_profiler/group_fps"
parent: "panel_druid_profiler/root" parent: "panel_druid_profiler/layout"
template_node_child: true template_node_child: true
} }
nodes { nodes {
@ -4873,7 +4879,7 @@ nodes {
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "panel_druid_profiler/group_components" id: "panel_druid_profiler/group_components"
parent: "panel_druid_profiler/root" parent: "panel_druid_profiler/layout"
template_node_child: true template_node_child: true
} }
nodes { nodes {
@ -4888,24 +4894,6 @@ nodes {
parent: "panel_druid_profiler/group_components" parent: "panel_druid_profiler/group_components"
template_node_child: true template_node_child: true
} }
nodes {
type: TYPE_BOX
id: "panel_druid_profiler/group_events"
parent: "panel_druid_profiler/root"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "panel_druid_profiler/text_events"
parent: "panel_druid_profiler/group_events"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "panel_druid_profiler/text_events_amount"
parent: "panel_druid_profiler/group_events"
template_node_child: true
}
layers { layers {
name: "druid" name: "druid"
} }

View File

@ -2,7 +2,7 @@
bob_folder=./ bob_folder=./
# You can point bob version for project in format "filename:sha" # You can point bob version for project in format "filename:sha"
bob_sha="195:87b6907759f7b8dff830d54b2250b8d721bde291" bob_sha="196:11d2cd3a9be17b2fc5a2cb5cea59bbfb4af1ca96"
# Select Defold channel. Values: stable, beta, alpha # Select Defold channel. Values: stable, beta, alpha
bob_channel="stable" bob_channel="stable"