Posted 17 January 2016 - 08:03 AM
I just saw the new character functionality added be ComputerCraft 1.7.6, so I decided to play around a little bit and see what I could do with them. I decided i'd try to print a sword graphic, based on the following image:
Unfortunately, it refuses to print the one pixel at the start of the blade, as seen here:
Here's the code I used:
I know it's quite inefficient, but it should still work.
Unfortunately, it refuses to print the one pixel at the start of the blade, as seen here:
Here's the code I used:
function getDrawingCharacter(...) -- Bools for topLeft, topRight, left, right, bottomLeft, bottomRight
local data = 0
for i = 1, #arg - 1 do if arg[i] then data = data + 2^(i-1) end end
return {char = string.char(arg[6] and 159 - data or 128 + data), inverted = arg[6]}
end
term.setBackgroundColor(32768)
term.setTextColor(1)
spr0 = mkspr(false, false, false, false, false, false)
spr1 = mkspr(false, false, false, false, false, false)
spr2 = mkspr(false, false, false, true, true, false)
spr3 = mkspr(true, true, false, true, true, false)
spr4 = mkspr(false, true, false, true, false, false)
spr5 = mkspr(false, true, true, false, true, true)
spr6 = mkspr(false, true, true, false, false, false)
spr7 = mkspr(false, false, false, false, false, false)
spr8 = mkspr(false, true, true, false, false, false)
spr9 = mkspr(false, true, false, false, false, false)
spra = mkspr(true, false, false, false, false, false)
sprb = mkspr(false, false, false, false, false, false)
term.clear()
term.setCursorPos(4, 4)
term.write(spr0.char)
term.write(spr1.char)
term.write(spr2.char)
term.write(spr3.char)
term.setCursorPos(4, 5)
term.write(spr4.char)
term.write(spr5.char)
term.write(spr6.char)
term.write(spr7.char)
term.setCursorPos(4, 6)
term.write(spr8.char)
term.write(spr9.char)
term.write(spra.char)
term.write(sprb.char)
term.setCursorPos(4, 7)
I know it's quite inefficient, but it should still work.