function getDrawingCharacter(topLeft, topRight, left, right, bottomLeft, bottomRight) local data = 128 if not bottomRight then data = data + (topLeft and 1 or 0) data = data + (topRight and 2 or 0) data = data + (left and 4 or 0) data = data + (right and 8 or 0) data = data + (bottomLeft and 16 or 0) else data = data + (topLeft and 0 or 1) data = data + (topRight and 0 or 2) data = data + (left and 0 or 4) data = data + (right and 0 or 8) data = data + (bottomLeft and 0 or 16) end return {char = string.char(data), inverted = bottomRight} end
Using this function you can specify which pixel you want to be on. As described before there are 6 pixels per character. Because of this the function has 6 boolean parameters to specify which pixel you want to be on. The function returns two values, the "char" and a boolean "inverted".
The char is the character you'd need to draw to get the pixels you want, however. It is possible that you'll have to switch the background and text color because there isn't a character for every possible combination. If this is the case "inverted" will be true.
Here's a little example:
pixels = getDrawingCharacter(true, true, true, false, true, true) if not pixels.inverted then term.setBackgroundColor(16384) term.setTextColor(1) else term.setBackgroundColor(1) term.setTextColor(16384) end term.write(pixels.char)
The function could probably be improved, please let me know if you have a better method.
Feel free to use this function wherever you want :-)
-Oli414
Edited by oli414, 12 December 2015 - 05:12 PM.