From 72692f5efcee2aa7b0339534cad8def56bcc8aab Mon Sep 17 00:00:00 2001 From: Insality Date: Wed, 5 Mar 2025 22:10:37 +0200 Subject: [PATCH] Update --- druid/extended/timer.lua | 16 ++++++++-------- druid/system/settings.lua | 2 ++ druid/widget/fps_panel/fps_panel.lua | 1 + druid/widget/memory_panel/memory_panel.lua | 1 + .../properties/property_button.lua | 1 + 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/druid/extended/timer.lua b/druid/extended/timer.lua index def5352..9472836 100644 --- a/druid/extended/timer.lua +++ b/druid/extended/timer.lua @@ -14,13 +14,6 @@ local component = require("druid.component") local M = component.create("timer") -local function second_string_min(sec) - local mins = math.floor(sec / 60) - local seconds = math.floor(sec - mins * 60) - return string.format("%.2d:%.2d", mins, seconds) -end - - ---@param node node Gui text node ---@param seconds_from number|nil Start timer value in seconds ---@param seconds_to number|nil End timer value in seconds @@ -80,7 +73,7 @@ end ---@return druid.timer self function M:set_to(set_to) self.last_value = set_to - gui.set_text(self.node, second_string_min(set_to)) + gui.set_text(self.node, self:_second_string_min(set_to)) return self end @@ -111,4 +104,11 @@ function M:set_interval(from, to) end +function M:_second_string_min(sec) + local mins = math.floor(sec / 60) + local seconds = math.floor(sec - mins * 60) + return string.format("%.2d:%.2d", mins, seconds) +end + + return M diff --git a/druid/system/settings.lua b/druid/system/settings.lua index 73c2db9..e0b2c21 100755 --- a/druid/system/settings.lua +++ b/druid/system/settings.lua @@ -9,7 +9,9 @@ function M.get_text(text_id, ...) return "[Druid]: locales not inited" end + function M.play_sound(sound_id) end + return M diff --git a/druid/widget/fps_panel/fps_panel.lua b/druid/widget/fps_panel/fps_panel.lua index acd067c..1795a43 100644 --- a/druid/widget/fps_panel/fps_panel.lua +++ b/druid/widget/fps_panel/fps_panel.lua @@ -10,6 +10,7 @@ if TARGET_FPS == 0 then TARGET_FPS = 60 end + function M:init() self.root = self:get_node("root") diff --git a/druid/widget/memory_panel/memory_panel.lua b/druid/widget/memory_panel/memory_panel.lua index cbe2915..c2a84fc 100644 --- a/druid/widget/memory_panel/memory_panel.lua +++ b/druid/widget/memory_panel/memory_panel.lua @@ -5,6 +5,7 @@ local mini_graph = require("druid.widget.mini_graph.mini_graph") ---@field root node local M = {} + function M:init() self.root = self:get_node("root") self.delta_time = 0.1 diff --git a/druid/widget/properties_panel/properties/property_button.lua b/druid/widget/properties_panel/properties/property_button.lua index adfe914..5b08073 100644 --- a/druid/widget/properties_panel/properties/property_button.lua +++ b/druid/widget/properties_panel/properties/property_button.lua @@ -9,6 +9,7 @@ local color = require("druid.color") ---@field druid druid.instance local M = {} + function M:init() self.root = self:get_node("root") self.text_name = self.druid:new_text("text_name")