Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gpu = require("component").gpu
- local unicode = require("unicode")
- hres = {}
- function hres.set(x, y, state)
- local x = math.floor(x)
- local y = math.floor(y)
- local scrx = math.ceil(x/2)
- local scry = math.ceil(y/4)
- local maxx, maxy = gpu.getResolution()
- if scrx > maxx or scry > maxy or scrx < 1 or scry < 1 then return end
- local prechar = gpu.get(scrx, scry)
- _, prechar = utf8.codes(prechar)(prechar)
- local offset = 0x2800
- local offsetx = (x-((math.floor(x/2))*2))
- if offsetx == 0 then offsetx = 2 end
- local offsety = y-(math.floor(y/4)*4)
- if offsetx == 1 then
- if offsety == 0 then
- brs = 7
- else
- brs = offsety
- end
- else
- if offsety == 0 then
- brs = 8
- else
- brs = offsety+3
- end
- end
- local offsetdec = 2^(brs-1)
- if prechar < offset or prechar > 0x28FF then
- prechar = offset
- end
- if state then
- gpu.set(scrx, scry, unicode.char(prechar+offsetdec))
- else
- gpu.set(scrx, scry, unicode.char(prechar-offsetdec))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement