mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Update
This commit is contained in:
parent
46223f0bb8
commit
72692f5efc
@ -14,13 +14,6 @@ local component = require("druid.component")
|
|||||||
local M = component.create("timer")
|
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 node node Gui text node
|
||||||
---@param seconds_from number|nil Start timer value in seconds
|
---@param seconds_from number|nil Start timer value in seconds
|
||||||
---@param seconds_to number|nil End timer value in seconds
|
---@param seconds_to number|nil End timer value in seconds
|
||||||
@ -80,7 +73,7 @@ end
|
|||||||
---@return druid.timer self
|
---@return druid.timer self
|
||||||
function M:set_to(set_to)
|
function M:set_to(set_to)
|
||||||
self.last_value = 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
|
return self
|
||||||
end
|
end
|
||||||
@ -111,4 +104,11 @@ function M:set_interval(from, to)
|
|||||||
end
|
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
|
return M
|
||||||
|
@ -9,7 +9,9 @@ function M.get_text(text_id, ...)
|
|||||||
return "[Druid]: locales not inited"
|
return "[Druid]: locales not inited"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M.play_sound(sound_id)
|
function M.play_sound(sound_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -10,6 +10,7 @@ if TARGET_FPS == 0 then
|
|||||||
TARGET_FPS = 60
|
TARGET_FPS = 60
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:init()
|
function M:init()
|
||||||
self.root = self:get_node("root")
|
self.root = self:get_node("root")
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ local mini_graph = require("druid.widget.mini_graph.mini_graph")
|
|||||||
---@field root node
|
---@field root node
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
|
||||||
function M:init()
|
function M:init()
|
||||||
self.root = self:get_node("root")
|
self.root = self:get_node("root")
|
||||||
self.delta_time = 0.1
|
self.delta_time = 0.1
|
||||||
|
@ -9,6 +9,7 @@ local color = require("druid.color")
|
|||||||
---@field druid druid.instance
|
---@field druid druid.instance
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
|
||||||
function M:init()
|
function M:init()
|
||||||
self.root = self:get_node("root")
|
self.root = self:get_node("root")
|
||||||
self.text_name = self.druid:new_text("text_name")
|
self.text_name = self.druid:new_text("text_name")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user