Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --pastebin get HEUWNFEW numAPI.lua
- --массив {card:string, monitor:string}
- clock = {"35f", "49f"}
- color1 = 0xFF0000 --цвет когда включен
- color2 = 0x222222 --цвет когда выключен
- numAPI = require("numAPI")
- os = require("os")
- math = require("math")
- component = require("component")
- event = require("event")
- --getRS = component.redstone.getInput
- gpu = component.proxy(component.get(clock[1]))
- gpu.bind(component.get(clock[2]))
- gpu.setResolution(48, 13)
- timeDisplay = {
- --часы
- h1 = numAPI.createNum(14, 1, 4, color1, color2, clock[1]),
- h2 = numAPI.createNum(4, 1, 4, color1, color2, clock[1]),
- --минуты
- m1 = numAPI.createNum(37, 1, 4, color1, color2, clock[1]),
- m2 = numAPI.createNum(27, 1, 4, color1, color2, clock[1]),
- }
- xr, yr = gpu.getResolution()
- gpu.fill(1, 1, xr, yr, ' ')
- function redraw()
- for t in pairs(timeDisplay) do
- timeDisplay[t]:drawNum()
- end
- end
- function setClock(t)
- local ttt = {
- h = math.floor(t / 60 / 60 + 1) % 24,
- m = math.floor(t / 60) % 60,
- }
- for cl in pairs(ttt) do
- local fh = math.floor(ttt[cl] / 10)
- local h = ttt[cl] - (fh * 10)
- timeDisplay[cl .. '2']:setNumber(fh)
- timeDisplay[cl .. '1']:setNumber(h)
- end
- end
- gpu.setBackground(color1)
- gpu.set(24, 9, ' ', true)
- gpu.set(24, 5, ' ', true)
- gpu.setBackground(0)
- secT = 0
- while true do
- os.sleep(1/20)
- timeOS = os.time()
- secT = secT + (1 / 20)
- setClock(timeOS)
- redraw()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement