mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
bind clock, fixes to waiting list
This commit is contained in:
8
modules/core_lib/math/math.lua
Normal file
8
modules/core_lib/math/math.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
function math.round(num, idp)
|
||||
local mult = 10^(idp or 0)
|
||||
if num >= 0 then
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
else
|
||||
return math.ceil(num * mult - 0.5) / mult
|
||||
end
|
||||
end
|
@@ -19,8 +19,12 @@ function UIProgressBar:getPercent()
|
||||
return self.percent
|
||||
end
|
||||
|
||||
function UIProgressBar:getPercentPixels()
|
||||
return 100 / self:getWidth()
|
||||
end
|
||||
|
||||
function UIProgressBar:updateBackground()
|
||||
local width = math.max((self.percent * self:getWidth())/100, 1)
|
||||
local width = math.round(math.max((self.percent * self:getWidth())/100, 1))
|
||||
local height = self:getHeight()
|
||||
self:setBackgroundSize({width=width, height=height})
|
||||
end
|
||||
|
Reference in New Issue
Block a user