Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("right")
- local width, height = mon.getSize()
- col = colors.orange
- function setup()
- mon.clear()
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- end
- divheight = height/2
- midheight = math.floor(divheight)
- function clickScreen()
- while true do
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- mon.setCursorPos(xPos, yPos)
- if yPos == height then
- mon.setBackgroundColor(colors.black)
- mon.clear()
- clearBar()
- elseif xPos == width then
- colorChange()
- elseif xPos == width-1 then
- colorChange()
- else
- term.redirect(mon)
- paintutils.drawPixel(xPos, yPos, col)
- term.restore()
- end
- end
- end
- function clearBar()
- mon.setCursorPos(1,height)
- mon.setBackgroundColor(colors.red)
- mon.clearLine()
- mon.write("[Clear]")
- mon.setBackgroundColor(colors.black)
- colorBar()
- end
- function colorBar()
- term.redirect(mon)
- paintutils.drawPixel(width, 1, colors.white)
- paintutils.drawPixel(width, 2, colors.orange)
- paintutils.drawPixel(width, 3, colors.magenta)
- paintutils.drawPixel(width, 3, colors.lightBlue)
- paintutils.drawPixel(width, 4, colors.yellow)
- paintutils.drawPixel(width, 5, colors.lime)
- paintutils.drawPixel(width, 6, colors.pink)
- paintutils.drawPixel(width, 7, colors.gray)
- paintutils.drawPixel(width, 8, colors.lightGray)
- paintutils.drawPixel(width, 9, colors.cyan)
- paintutils.drawPixel(width, 10, colors.purple)
- paintutils.drawPixel(width, 11, colors.blue)
- paintutils.drawPixel(width, 12, colors.brown)
- paintutils.drawPixel(width, 13, colors.green)
- paintutils.drawPixel(width, 14, colors.red)
- mon.setBackgroundColor(colors.black)
- term.setCursorPos(width, 15)
- term.setTextColor(colors.white)
- term.write("X")
- term.restore()
- end
- function colorChange()
- if xPos == width and yPos == 1 then
- col = colors.white
- elseif xPos == width and yPos == 2 then
- col = colors.orange
- elseif xPos == width and yPos == 3 then
- col = colors.lightBlue
- elseif xPos == width and yPos == 4 then
- col = colors.yellow
- elseif xPos == width and yPos == 5 then
- col = colors.lime
- elseif xPos == width and yPos == 6 then
- col = colors.pink
- elseif xPos == width and yPos == 7 then
- col = colors.gray
- elseif xPos == width and yPos == 8 then
- col = colors.lightGray
- elseif xPos == width and yPos == 9 then
- col = colors.cyan
- elseif xPos == width and yPos == 10 then
- col = colors.purple
- elseif xPos == width and yPos == 11 then
- col = colors.blue
- elseif xPos == width and yPos == 12 then
- col = colors.brown
- elseif xPos == width and yPos == 13 then
- col = colors.green
- elseif xPos == width and yPos == 14 then
- col = colors.red
- elseif xPos == width and yPos == 15 then
- col = colors.black
- end
- end
- setup()
- colorBar()
- clearBar()
- clickScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement