Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monR = peripheral.wrap("right")
- local monL = peripheral.wrap("left")
- local monB = peripheral.wrap("bottom")
- local monX,monY = monB.getSize()
- monR.setTextScale(3.5)
- monL.setTextScale(3.5)
- monB.setTextScale(2)
- monL.clear()
- monR.clear()
- monB.clear()
- local function monWrite(side, string, x, y, BGcolor, color)
- if not color then color = colors.white end
- if not BGcolor then BGcolor = colors.black end
- local mon = peripheral.wrap(side)
- mon.setCursorPos(x,y)
- mon.setTextColor(color)
- mon.setBackgroundColor(BGcolor)
- mon.write(string)
- end
- local function cPrint(side, string, y, BGcolor, color)
- local x = (monX/4) - (string.len(string)/4)
- monWrite(side, string, x, y, BGcolor, color)
- end
- local function header(title)
- monR.setBackgroundColor(colors.black)
- monR.clear()
- monR.setCursorPos(1,1)
- for i = 1,2 do
- monWrite("left", string.rep(" ",monX), 1, i, colors.lightBlue, colors.white)
- monWrite("right", string.rep(" ",monX), 1, i, colors.lightBlue, colors.white)
- end
- monWrite("left", title, 1, 1, colors.lightBlue, colors.white)
- monWrite("right", title, 1, 1, colors.lightBlue, colors.white)
- end
- local function content(line, string)
- monWrite("bottom", string, 1, line)
- end
- local function getSlides(lesson)
- local lessonSlides = fs.list(lesson)
- local slideContent = {}
- for i = 1,#lessonSlides do
- local file = fs.open(lesson.."/"..i, "r")
- slide = {}
- repeat
- local slideLine = file.readLine()
- table.insert(slide, slideLine)
- until slideLine == nil
- table.insert(slideContent, slide)
- end
- return slideContent
- end
- term.clear()
- term.setCursorPos(1,1)
- write("Lesson title: ")
- local lessonTitle = read()
- local contentLines = getSlides(lessonTitle)
- term.clear()
- term.setCursorPos(1,7)
- print(" /")
- print(" / ")
- print("/ ")
- print("\\ ")
- print(" \\ ")
- print(" \\")
- term.setCursorPos(48,7)
- write("\\ ")
- term.setCursorPos(48,8)
- write(" \\ ")
- term.setCursorPos(48,9)
- write(" \\")
- term.setCursorPos(48,10)
- write(" /")
- term.setCursorPos(48,11)
- write(" / ")
- term.setCursorPos(48,12)
- write("/ ")
- term.setCursorPos(1,1)
- write(textutils.serialize(contentLines))
- while true do
- local events = {os.pullEvent()}
- if events[1] == "mouse_click" and events[2] == 2 then
- for i = 1,#contentLines do
- if i == 1 then
- header(contentLines[i])
- else
- content(i, contentLines[i])
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment