Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bigfont = require("bigfont")
- local gfx = {}
- function gfx.drawHeader(t, text)
- t.setTextColour(colours.white)
- bigfont.writeOn(t, 1, text, nil, 2)
- end
- function gfx.drawFooter(t, text)
- local w, h = t.getSize()
- t.setTextColour(colours.grey)
- gfx.writeCentred(t, w, text, h)
- end
- function gfx.writeCentred(t, w, text, y)
- t.setCursorPos(math.ceil((w - #text) / 2), y)
- t.write(text)
- end
- function gfx.colourToBlit(col)
- return string.format("%x", math.log(col, 2))
- end
- function gfx.drawLoading(t)
- local w, h = t.getSize()
- local centerY = math.ceil(h / 2)
- t.setTextColour(colours.lightGrey)
- gfx.writeCentred(t, w, "Loading...", centerY)
- return centerY
- end
- function gfx.clearLoading(t, centerY)
- t.setCursorPos(1, centerY)
- t.clearLine(0)
- end
- function gfx.drawBox(t, x, y, w, h)
- t.setTextColour(colours.grey)
- t.setCursorPos(x, y)
- t.write("\156" .. ("\140"):rep(w - 2) .. "\148")
- for i = y + 1, y + h - 1 do
- t.setCursorPos(x, i)
- t.write("\149" .. (" "):rep(w - 2) .. "\149")
- end
- t.setCursorPos(x, y + h)
- t.write(("\131"):rep(w - 1) .. "\129")
- end
- return gfx
Add Comment
Please, Sign In to add comment