mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 19:19:21 +01:00
Прогрессбар-фича
This commit is contained in:
parent
1f1516ceae
commit
833c1eb406
@ -319,7 +319,7 @@
|
|||||||
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/GUI.lua",
|
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/GUI.lua",
|
||||||
type="Library",
|
type="Library",
|
||||||
preloadFile=true,
|
preloadFile=true,
|
||||||
version=2.08,
|
version=2.09,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path="/lib/rayEngine.lua",
|
path="/lib/rayEngine.lua",
|
||||||
|
|||||||
@ -797,7 +797,7 @@ end
|
|||||||
----------------------------------------- ProgressBar Object -----------------------------------------
|
----------------------------------------- ProgressBar Object -----------------------------------------
|
||||||
|
|
||||||
local function drawProgressBar(object)
|
local function drawProgressBar(object)
|
||||||
local activeWidth = math.floor(object.value * object.width / 100)
|
local activeWidth = math.floor(math.min(object.value, 100) / 100 * object.width)
|
||||||
if object.thin then
|
if object.thin then
|
||||||
buffer.text(object.x, object.y, object.colors.passive, string.rep("━", object.width))
|
buffer.text(object.x, object.y, object.colors.passive, string.rep("━", object.width))
|
||||||
buffer.text(object.x, object.y, object.colors.active, string.rep("━", activeWidth))
|
buffer.text(object.x, object.y, object.colors.active, string.rep("━", activeWidth))
|
||||||
@ -807,7 +807,7 @@ local function drawProgressBar(object)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if object.showValue then
|
if object.showValue then
|
||||||
local stringValue = tostring((object.valuePrefix or "") .. object.value .. (object.valuePostfix or ""))
|
local stringValue = (object.valuePrefix or "") .. object.value .. (object.valuePostfix or "")
|
||||||
buffer.text(math.floor(object.x + object.width / 2 - unicode.len(stringValue) / 2), object.y + 1, object.colors.value, stringValue)
|
buffer.text(math.floor(object.x + object.width / 2 - unicode.len(stringValue) / 2), object.y + 1, object.colors.value, stringValue)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user