Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defaultColor = BrickColor.new(255, 255, 255)
- bgColor = BrickColor.new(0, 0, 0)
- screenWidth = 30
- screenHeight = 50
- _G["draw"] = function()
- --Put your drawing code here
- end
- function lerp(a, b, x)
- if a == b then return a end
- return a + x * (b - a)
- end
- function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- function distance(x1, y1, x2, y2)
- a = y2 - y1;
- b = x2 - x1;
- return math.sqrt(a * a + b * b)
- end
- _G["drawLetter"] = function(x, y, letter, color)
- local color = color or defaultColor
- if font[letter] == nil then
- letter_arr = font["space"]
- elseif letter == "(" then
- letter_arr = font["lparen"]
- elseif letter == ")" then
- letter_arr = font["rparen"]
- elseif letter == "*" then
- letter_arr = font["asterisk"]
- elseif letter == "+" then
- letter_arr = font["plus"]
- elseif letter == "," then
- letter_arr = font["comma"]
- elseif letter == "-" then
- letter_arr = font["dash"]
- elseif letter == "." then
- letter_arr = font["period"]
- elseif letter == "/" then
- letter_arr = font["slash"]
- elseif letter == " " then
- letter_arr = font["space"]
- elseif letter == "!" then
- letter_arr = font["exclamation"]
- elseif letter == "\"" then
- letter_arr = font["quote"]
- elseif letter == "$" then
- letter_arr = font["dollar"]
- elseif letter == "'" then
- letter_arr = font["apostrophe"]
- elseif letter == "0" then
- letter_arr = font["n0"]
- elseif letter == "1" then
- letter_arr = font["n1"]
- elseif letter == "2" then
- letter_arr = font["n2"]
- elseif letter == "3" then
- letter_arr = font["n3"]
- elseif letter == "4" then
- letter_arr = font["n4"]
- elseif letter == "5" then
- letter_arr = font["n5"]
- elseif letter == "6" then
- letter_arr = font["n6"]
- elseif letter == "7" then
- letter_arr = font["n7"]
- elseif letter == "8" then
- letter_arr = font["n8"]
- elseif letter == "9" then
- letter_arr = font["n9"]
- elseif letter == ":" then
- letter_arr = font["colon"]
- elseif letter == ";" then
- letter_arr = font["semi"]
- elseif letter == "<" then
- letter_arr = font["lessthan"]
- elseif letter == "=" then
- letter_arr = font["equals"]
- elseif letter == ">" then
- letter_arr = font["greaterthan"]
- elseif letter == "?" then
- letter_arr = font["question"]
- elseif letter == "_" then
- letter_arr = font["underscore"]
- else
- letter_arr = font[letter]
- end
- local i, v, i2, v2
- for i, v in ipairs(letter_arr) do
- for i2, v2 in ipairs(letter_arr[i]) do
- local myX = x + i2
- local myY = y+ i
- if v2 == 1 then
- setPixel(myX, myY, color)
- end
- end
- end
- end
- _G["drawText"] = function(x, y, text, color)
- local text = string.upper(text)
- local color = color or defaultColor
- local i = 0
- for i = 0, string.len(text) do
- letter = string.sub(text, i + 1, i + 1)
- drawLetter(x + (6*i), y, letter, color)
- end
- end
- _G["drawCircle"] = function(x, y, radius, color)
- local color = color or defaultColor
- local draw_x, draw_y
- local sqRadius = radius * radius
- for draw_x=-radius, radius do
- for draw_y=-radius, radius do
- if draw_x^2 + draw_y^2 <= sqRadius and x + draw_x > 0 then
- setPixel(x + draw_x, y + draw_y, color)
- end
- end
- end
- end
- _G["filledRect"] = function(x1, y1, x2, y2, color)
- local color = color or defaultColor
- local drawX, drawY
- for drawX = x1, x2 do
- for drawY = y1, y2 do
- setPixel(drawX, drawY, color)
- end
- end
- end
- _G["drawLine"] = function(x1, y1, x2, y2, color)
- local color = color or defaultColor
- local drawX = 0
- local drawY = 0
- local d = round(distance(x1, y1, x2, y2))
- for i=0, d do
- drawX = round(lerp(x1, x2, i/d))
- drawY = round(lerp(y1, y2, i/d))
- setPixel(drawX, drawY, color)
- end
- end
- _G["outlineRect"] = function(x1, y1, x2, y2, color)
- local color = color or defaultColor
- drawLine(x1, y1, x1, y2, color)
- drawLine(x1, y1, x2, y1, color)
- drawLine(x1, y2, x2, y2, color)
- drawLine(x2, y1, x2, y2, color)
- end
- _G["fill"] = function(color)
- local color = color or bgColor
- local pixels = game.Workspace.LEDScreen:getChildren()
- local p = 0
- for c = 1, #pixels do
- pixels[c].BrickColor = color
- end
- end
- _G["invert"] = function()
- local pixels = game.Workspace.LEDScreen:getChildren()
- local color
- for c = 1, #pixels do
- local curColor = pixels[c].BrickColor
- if curColor == defaultColor then
- color = bgColor
- else
- color = defaultColor
- end
- pixels[c].BrickColor = color
- end
- end
- _G["setPixel"] = function(x, y, color)
- local s = game.Workspace.LEDScreen
- local p = s:FindFirstChild(x.." "..y)
- if p ~= nil then
- p.BrickColor = color
- end
- end
- _G["generateScreen"] = function(start, width, height)
- local part = Instance.new("Part")
- part.formFactor = "Symmetric"
- part.Size = Vector3.new(1, 1, 1)
- part.Anchored = true
- part.BrickColor = bgColor
- local height2 = height/2
- local width2 = width/2
- for x2 = width2, 0, -0.5 do
- for y2 = height2, 0, -0.5 do
- local newPart = part:Clone()
- local mesh = Instance.new("BlockMesh")
- mesh.Scale = Vector3.new(0.5, 0.5, 0.5)
- mesh.Parent = newPart
- local pos = Vector3.new(start.x - x2, start.y - y2, start.z)
- newPart.CFrame = CFrame.new(pos)
- newPart.Parent = game.Workspace.LEDScreen
- newPart.Name = (x2 * 2).." "..(y2 * 2)
- end
- end
- setPixel(2, 2, BrickColor.Yellow())
- end
- font =
- {
- lparen = {
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- {0, 1, 0, 0, 0},
- {0, 1, 0, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 1, 0},
- },
- rparen = {
- {0, 1, 0, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 1, 0},
- {0, 0, 0, 1, 0},
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- },
- asterisk = {
- {0, 0, 0, 0, 0},
- {0, 0, 1, 0, 0},
- {1, 0, 1, 0, 1},
- {0, 1, 1, 1, 0},
- {1, 0, 1, 0, 1},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 0, 0},
- },
- plus = {
- {0, 0, 0, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {1, 1, 1, 1, 1},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 0, 0},
- },
- comma = {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- },
- dash = {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- period = {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 1, 1, 0, 0},
- },
- slash = {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- space = {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- exclamation = {
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 1, 0, 0},
- },
- quote = {
- {0, 1, 0, 1, 0},
- {0, 1, 0, 1, 0},
- {0, 1, 0, 1, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- dollar = {
- {0, 0, 1, 0, 0},
- {0, 1, 1, 1, 1},
- {1, 0, 1, 0, 0},
- {0, 1, 1, 1, 0},
- {0, 0, 1, 0, 1},
- {1, 1, 1, 1, 0},
- {0, 0, 1, 0, 0},
- },
- apostrophe = {
- {0, 1, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- n0 = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 1, 1},
- {1, 0, 1, 0, 1},
- {1, 1, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- n1 = {
- {0, 0, 1, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 1, 1, 0},
- },
- n2 = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- {1, 1, 1, 1, 1},
- },
- n3 = {
- {1, 1, 1, 1, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 1, 0},
- {0, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- n4 = {
- {0, 0, 0, 1, 0},
- {0, 0, 1, 1, 0},
- {0, 1, 0, 1, 0},
- {1, 0, 0, 1, 0},
- {1, 1, 1, 1, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 0, 1, 0},
- },
- n5 = {
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 0},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- n6 = {
- {0, 0, 1, 1, 0},
- {0, 1, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- n7 = {
- {1, 1, 1, 1, 1},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- {0, 1, 0, 0, 0},
- {0, 1, 0, 0, 0},
- },
- n8 = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- n9 = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 1},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 1, 0},
- {0, 1, 1, 0, 0},
- },
- colon = {
- {0, 0, 0, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 0, 0, 0, 0},
- },
- semi = {
- {0, 0, 0, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- },
- lessthan = {
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {0, 1, 0, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 1, 0},
- },
- equals = {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- {0, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- greaterthan = {
- {0, 1, 0, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 1, 0},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- },
- question = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 1, 0, 0},
- },
- A = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- },
- B = {
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 0},
- },
- C = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- D = {
- {1, 1, 1, 0, 0},
- {1, 0, 0, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 1, 0},
- {1, 1, 1, 0, 0},
- },
- E = {
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- },
- F = {
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- },
- G = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 0},
- {1, 0, 1, 1, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 1},
- },
- H = {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- },
- I = {
- {0, 1, 1, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 1, 1, 0},
- },
- J = {
- {0, 0, 1, 1, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 0, 1, 0},
- {0, 0, 0, 1, 0},
- {0, 0, 0, 1, 0},
- {1, 0, 0, 1, 0},
- {0, 1, 1, 0, 0},
- },
- K = {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 1, 0},
- {1, 0, 1, 0, 0},
- {1, 1, 0, 0, 0},
- {1, 0, 1, 0, 0},
- {1, 0, 0, 1, 0},
- {1, 0, 0, 0, 1},
- },
- L = {
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- },
- M = {
- {1, 0, 0, 0, 1},
- {1, 1, 0, 1, 1},
- {1, 0, 1, 0, 1},
- {1, 0, 1, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- },
- N = {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 0, 0, 1},
- {1, 0, 1, 0, 1},
- {1, 0, 0, 1, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- },
- O = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- P = {
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- },
- Q = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 1, 0, 1},
- {1, 0, 0, 1, 0},
- {0, 1, 1, 0, 1},
- },
- R = {
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 0},
- {1, 0, 1, 0, 0},
- {1, 0, 0, 1, 0},
- {1, 0, 0, 0, 1},
- },
- S = {
- {0, 1, 1, 1, 1},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {0, 1, 1, 1, 0},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 0, 1},
- {1, 1, 1, 1, 0},
- },
- T = {
- {1, 1, 1, 1, 1},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- },
- U = {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- W = {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 1, 0, 1},
- {1, 0, 1, 0, 1},
- {1, 0, 1, 0, 1},
- {0, 1, 0, 1, 1},
- },
- X = {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- },
- Y = {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 0, 1, 1},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- {0, 0, 1, 0, 0},
- },
- Z = {
- {1, 1, 1, 1, 1},
- {0, 0, 0, 0, 1},
- {0, 0, 0, 1, 0},
- {0, 0, 1, 0, 0},
- {0, 1, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- },
- underscore = {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement