Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Total, Operando = 0, ""
- function Gui()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.write(Total)
- term.setCursorPos(1,2)
- term.write(Operando)
- --remove when done
- paintutils.drawLine(27,1,27,20,colors.white)
- --Number buttons
- paintutils.drawFilledBox(1,4,5,7,colors.yellow)
- term.setCursorPos(3,6)
- term.write("7")
- paintutils.drawFilledBox(6,4,10,7,colors.yellow)
- term.setCursorPos(8,6)
- term.write("8")
- paintutils.drawFilledBox(11,4,15,7,colors.yellow)
- term.setCursorPos(13,6)
- term.write("9")
- paintutils.drawFilledBox(1,8,5,11,colors.yellow)
- term.setCursorPos(3,10)
- term.write("4")
- paintutils.drawFilledBox(6,8,10,11,colors.yellow)
- term.setCursorPos(8,10)
- term.write("5")
- paintutils.drawFilledBox(11,8,15,11,colors.yellow)
- term.setCursorPos(13,10)
- term.write("6")
- paintutils.drawFilledBox(1,12,5,15,colors.yellow)
- term.setCursorPos(3,14)
- term.write("1")
- paintutils.drawFilledBox(6,12,10,15,colors.yellow)
- term.setCursorPos(8,14)
- term.write("2")
- paintutils.drawFilledBox(11,12,15,15,colors.yellow)
- term.setCursorPos(13,14)
- term.write("3")
- paintutils.drawFilledBox(1,16,5,19,colors.yellow)
- term.setCursorPos(3,18)
- term.write("")
- paintutils.drawFilledBox(6,16,10,19,colors.yellow)
- term.setCursorPos(8,18)
- term.write("0")
- paintutils.drawFilledBox(11,16,15,19,colors.yellow)
- term.setCursorPos(13,18)
- term.write(",")
- --Operators Buttons
- paintutils.drawFilledBox(16,4,20,7,colors.gray)
- term.setCursorPos(18,6)
- term.write("/")
- paintutils.drawFilledBox(21,4,26,7,colors.gray)
- term.setCursorPos(23,6)
- term.write("CE")
- paintutils.drawFilledBox(16,8,20,11,colors.gray)
- term.setCursorPos(18,10)
- term.write("*")
- paintutils.drawFilledBox(21,8,26,11,colors.gray)
- term.setCursorPos(23,10)
- term.write("+")
- paintutils.drawFilledBox(16,12,20,15,colors.gray)
- term.setCursorPos(18,14)
- term.write("-")
- paintutils.drawFilledBox(21,12,26,15,colors.gray)
- term.setCursorPos(23,14)
- term.write("")
- paintutils.drawFilledBox(16,16,20,19,colors.gray)
- term.setCursorPos(18,18)
- term.write("%")
- paintutils.drawFilledBox(21,16,26,19,colors.gray)
- term.setCursorPos(23,18)
- term.write("=")
- end
- -- Main --
- while (true) do
- Gui()
- term.setCursorPos(1,1)
- local e, b, x,y = os.pullEvent()
- if (e == "key") then
- local key = keys.getName(b)
- if (key == "+") then
- operando = "+"
- elseif (key == "-") then
- operando = "-"
- elseif (key == "*") then
- operando = "*"
- elseif (key == "/") then
- operando = "/"
- else
- if (keys.getName(b) == "zero") then key = "0"
- elseif (keys.getName(b) == "one") then key = "1"
- elseif (keys.getName(b) == "two") then key = "2"
- elseif (keys.getName(b) == "three") then key = "3"
- elseif (keys.getName(b) == "four") then key = "4"
- elseif (keys.getName(b) == "five") then key = "5"
- elseif (keys.getName(b) == "six") then key = "6"
- elseif (keys.getName(b) == "seven") then key = "7"
- elseif (keys.getName(b) == "eight") then key = "8"
- elseif (keys.getName(b) == "nine") then key = "9"
- end
- if (Operando == "") then
- Total = tonumber(key)
- elseif (Operando == "+") then
- Total = Total + tonumber(key)
- elseif (Operando == "-") then
- Total = Total - tonumber(key)
- elseif (Operando == "*") then
- Total = Total * tonumber(key)
- elseif (Operando == "/") then
- Total = Total / tonumber(key)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement