mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 02:17:52 +02:00
Update
This commit is contained in:
parent
af44d0d26e
commit
28bd165cee
@ -54,7 +54,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "Placeholder"
|
||||
font: "text_bold"
|
||||
font: "druid_text_bold"
|
||||
id: "placeholder_text"
|
||||
outline {
|
||||
x: 0.4
|
||||
@ -87,7 +87,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "User input"
|
||||
font: "text_bold"
|
||||
font: "druid_text_bold"
|
||||
id: "input_text"
|
||||
shadow {
|
||||
x: 1.0
|
||||
@ -145,7 +145,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "|"
|
||||
font: "text_bold"
|
||||
font: "druid_text_bold"
|
||||
id: "cursor_text"
|
||||
shadow {
|
||||
x: 1.0
|
||||
|
@ -519,4 +519,21 @@ function M.remove_with_shift(array, index, shift_policy)
|
||||
end
|
||||
|
||||
|
||||
---Get full position of node in the GUI tree
|
||||
---@param node node GUI node
|
||||
---@param root node|nil GUI root node to stop search
|
||||
function M.get_full_position(node, root)
|
||||
local position = gui.get_position(node)
|
||||
local parent = gui.get_parent(node)
|
||||
while parent and parent ~= root do
|
||||
local parent_position = gui.get_position(parent)
|
||||
position.x = position.x + parent_position.x
|
||||
position.y = position.y + parent_position.y
|
||||
parent = gui.get_parent(parent)
|
||||
end
|
||||
|
||||
return position
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
@ -1,3 +1,4 @@
|
||||
local helper = require("druid.helper")
|
||||
local mini_graph = require("druid.widget.mini_graph.mini_graph")
|
||||
|
||||
---@class widget.fps_panel: druid.widget
|
||||
@ -22,7 +23,13 @@ function M:init()
|
||||
self.mini_graph:set_samples(self.graph_samples) -- show last 30 seconds
|
||||
self.mini_graph:set_max_value(TARGET_FPS)
|
||||
|
||||
gui.set_parent(self:get_node("content"), self.mini_graph.content, true)
|
||||
do -- Set parent manually
|
||||
local parent_node = self.mini_graph.content
|
||||
local position = helper.get_full_position(parent_node, self.mini_graph.root)
|
||||
local content = self:get_node("content")
|
||||
gui.set_parent(content, self.mini_graph.content)
|
||||
gui.set_position(content, -position)
|
||||
end
|
||||
|
||||
self.text_min_fps = self.druid:new_text("text_min_fps")
|
||||
self.text_fps = self.druid:new_text("text_fps")
|
||||
|
@ -1,3 +1,4 @@
|
||||
local helper = require("druid.helper")
|
||||
local mini_graph = require("druid.widget.mini_graph.mini_graph")
|
||||
|
||||
---@class widget.memory_panel: druid.widget
|
||||
@ -5,13 +6,24 @@ local mini_graph = require("druid.widget.mini_graph.mini_graph")
|
||||
local M = {}
|
||||
|
||||
function M:init()
|
||||
self.root = self:get_node("root")
|
||||
self.delta_time = 0.1
|
||||
self.samples_count = 30
|
||||
self.memory_limit = 100
|
||||
|
||||
self.mini_graph = self.druid:new_widget(mini_graph, "mini_graph")
|
||||
self.mini_graph:set_samples(self.samples_count)
|
||||
gui.set_parent(self:get_node("content"), self.mini_graph.content, true)
|
||||
|
||||
-- This one is not works with scaled root
|
||||
--gui.set_parent(self:get_node("content"), self.mini_graph.content, true)
|
||||
|
||||
do -- Set parent manually
|
||||
local parent_node = self.mini_graph.content
|
||||
local position = helper.get_full_position(parent_node, self.mini_graph.root)
|
||||
local content = self:get_node("content")
|
||||
gui.set_parent(content, self.mini_graph.content)
|
||||
gui.set_position(content, -position)
|
||||
end
|
||||
|
||||
self.max_value = self.druid:new_text("text_max_value")
|
||||
self.text_per_second = self.druid:new_text("text_per_second")
|
||||
|
@ -37,7 +37,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "Input"
|
||||
font: "text_bold"
|
||||
font: "druid_text_bold"
|
||||
id: "text_name"
|
||||
pivot: PIVOT_W
|
||||
outline {
|
||||
|
@ -37,7 +37,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "Text"
|
||||
font: "text_bold"
|
||||
font: "druid_text_bold"
|
||||
id: "text_name"
|
||||
pivot: PIVOT_W
|
||||
outline {
|
||||
@ -74,7 +74,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "Text"
|
||||
font: "text_bold"
|
||||
font: "druid_text_bold"
|
||||
id: "text_right"
|
||||
pivot: PIVOT_E
|
||||
outline {
|
||||
|
Loading…
x
Reference in New Issue
Block a user