feat: add star progress bar
This commit is contained in:
@@ -10,6 +10,7 @@ END_DATE = {day=12, month=12, year=2025}
|
|||||||
local json = require("json")
|
local json = require("json")
|
||||||
local dates = require("dates")
|
local dates = require("dates")
|
||||||
local days = require("days")
|
local days = require("days")
|
||||||
|
local progress = require "progress"
|
||||||
local today = os.date("*t")
|
local today = os.date("*t")
|
||||||
|
|
||||||
local function loadStats(path)
|
local function loadStats(path)
|
||||||
@@ -90,9 +91,13 @@ local function printStats(stats, selected)
|
|||||||
term.setTextColor(colors.white)
|
term.setTextColor(colors.white)
|
||||||
write(string.format("You have %d", stars))
|
write(string.format("You have %d", stars))
|
||||||
term.setTextColor(colors.orange)
|
term.setTextColor(colors.orange)
|
||||||
write("\x04")
|
write("\x04 ")
|
||||||
|
local x, y = term.getCursorPos()
|
||||||
|
progress.bar(x, y, 20, stars, 24, colors.orange, colors.gray)
|
||||||
term.setTextColor(colors.white)
|
term.setTextColor(colors.white)
|
||||||
print()
|
print()
|
||||||
|
print()
|
||||||
|
print("Press END to quit")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function printBanner()
|
local function printBanner()
|
||||||
|
|||||||
@@ -86,4 +86,8 @@ function utils.splitLines(data)
|
|||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function utils.round(x)
|
||||||
|
return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)
|
||||||
|
end
|
||||||
|
|
||||||
return utils
|
return utils
|
||||||
|
|||||||
Reference in New Issue
Block a user