Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local pc = component.computer
- local gpu = component.gpu
- local energy = component.basic_energy_cube
- local counter = 0
- local w, h = gpu.getResolution()
- local max_energy = energy.getMaxEnergyStored()
- function progressBar(ab, cd)
- local presizedw = ((w - 15) / cd * ab)
- gpu.setBackground(0x000000, false)
- gpu.fill(3, 10, w - 15, 2, " ")
- gpu.setBackground(0x09EF70, false)
- gpu.fill(3, 10, presizedw, 2, " ")
- gpu.setBackground(0x123123, false)
- end
- function startRendering()
- local active_energy = energy.getEnergyStored()
- gpu.fill(1, 1, w, h, " ")
- gpu.setForeground(0x000000, false)
- gpu.setBackground(0xD9D9D9, false)
- progressBar(active_energy, max_energy)
- gpu.set(w / 2, h / 2, "energy: " .. active_energy)
- gpu.setForeground(0x0980EF)
- end
- function caller()
- while true do
- os.sleep(0.5)
- startRendering()
- end
- end
- caller()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement