Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Neekow's Printer [WIP]
- local version = 0.1
- local pageChoisie = {}
- pageOrganisee = {
- " _______________________ ",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "|_______________________|",
- "| | Page: |",
- "|____________|__________|"}
- pageTitre = {
- " _______________________ ",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "|_______________________|",
- "| Writen by: |",
- "| |",
- "|_______________________|"}
- pageLibre = {
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " "}
- barreoption= {
- "#########################",
- "# #",
- "#########################",
- " _____________________ ",
- " | | ",
- " | | ",
- " |____________ ________| ",
- " | | | ",
- " | | | ",
- " | |________| ",
- " | | | ",
- " | | | ",
- " | |________| ",
- " | | | ",
- " | | | ",
- " |____________|________| ",
- " | | ",
- " | | ",
- " |_____________________| ",
- " "}
- buttonPage = {
- -- nom, Xpos, Ypox, TextColor, BGColor, pageChoisie
- {"FAQ",32,9,colors.lightGray,colors.black,pageFAQ},
- {"Title",31,10,colors.gray,colors.white,pageTitre},
- {"Organized",29,11,colors.lightGray,colors.black,pageOrganisee},
- {"Free page",29,12,colors.gray,colors.white,pageLibre}}
- buttonTitre = {
- -- nom, Xpos, Ypox, TextColor, BGColor
- {"Neekow's Printer V"..tostring(version),29,2,colors.white,colors.black},
- {"Page title:",34,5,colors.white,colors.black},
- {"Page type:",30,8,colors.white,colors.black}}
- buttonProg = {
- -- nom, Xpos, Ypox, TextColor, BGColor
- {"New Page",42,9,colors.white,colors.black},
- {"Print",43,12,colors.white,colors.black},
- {"Quit",44,15,colors.white,colors.black}}
- function ecran()
- for i= 1, #barreoption do
- term.setCursorPos(27,i)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.write(barreoption[i])
- end
- for i, buttonP in ipairs(buttonPage) do
- term.setCursorPos(29,buttonP[3])
- term.setBackgroundColor(buttonP[4])
- term.write(" ")
- term.setCursorPos(buttonP[2],buttonP[3])
- term.setTextColor(buttonP[5])
- term.write(buttonP[1])
- pageChoisie = buttonP[6]
- end
- for i,buttonT in ipairs(buttonTitre) do
- term.setCursorPos(buttonT[2],buttonT[3])
- term.setTextColor(buttonT[4])
- term.setBackgroundColor(buttonT[5])
- term.write(buttonT[1])
- end
- for i,buttonPr in ipairs(buttonProg) do
- term.setCursorPos(buttonPr[2],buttonPr[3])
- term.setTextColor(buttonPr[4])
- term.setBackgroundColor(buttonPr[5])
- term.write(buttonPr[1])
- end
- end
- function page()
- -- if pageChoisie == nil then pageChoisie = pageLibre end
- for i= 1, #pageChoisie do
- term.setCursorPos(1,i-1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.write(pageChoisie[i])
- end
- end
- function croix()
- for i, buttonP in ipairs(buttonPage) do
- if pageChoisie == buttonP[6] then
- term.setBackgroundColor(buttonP[4])
- term.setTextColor(colors.lime)
- term.setCursorPos(39,buttonP[3])
- term.write("x")
- end
- end
- end
- --- programme ---
- ecran()
- while true do
- event, button, xPos, yPos = os.pullEvent("mouse_click")
- for i, buttonP in ipairs(buttonPage) do
- if xPos >= 29 and xPos <= 31 and yPos == buttonP then
- pageChoisie = buttonP[6]
- end
- end
- croix()
- page(pageChoisie)
- end
Advertisement
Add Comment
Please, Sign In to add comment