Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this is the BlueTunes program
- --copyright of BlueTide Programs.inc, Benedict Allen, all members of BlueTide Programs.inc and all members of programcraft.inc
- --if you wish to use this program please contact Benedict Allen(awsumben13 on cc forums) and make sure you give the credit to BlueTide Programs
- --usability functions
- local function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function clearPos(x,y)
- term.clear()
- term.setCursorPos(x,y)
- end
- local function printLine(x,y,text)
- term.setCursorPos(x,y)
- print(text)
- end
- function clearPrint(x,y,text)
- term.clear()
- term.setCursorPos(x,y)
- print(text)
- end
- function reset(file, x, y)
- if fs.exists(file) then
- h = fs.open(file, "w")
- h.write("")
- h.close()
- term.setCursorPos(x,y)
- print("File reset")
- sleep(2)
- else
- term.setCursorPos(x,y)
- print("file not found")
- sleep(2)
- end
- end
- function tip(help)
- while true do
- clear()
- print(help)
- printLine(1,17,"press enter to exit")
- event, key = os.pullEvent()
- if key == 28 then break
- end
- end
- end
- function drawloading()
- print("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO")
- print("O O")
- print("O O")
- print("O OOO O O O OOOO OOOO OOOO OOO OOOO O")
- print("O O O O O O O OO OO O O O O")
- print("O OOOO O O O OOOO OO OO O O OOOO O")
- print("O O O O O O O OO OO O O O O")
- print("O OOO OOOO OOO OOOO OO OOOO OOO OOOO O")
- print("O O")
- print("O systems.inc O")
- print("O O")
- print("O loading[ ] O")
- print("O O")
- print("O O")
- print("O O")
- print("O Made by: Benedict Allen O")
- print("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO")
- end
- function startup()
- term.clear()
- term.setCursorPos(1,1)
- drawloading()
- printLine(27,12,"O ")
- sleep(0.3)
- printLine(27,12," O ")
- sleep(0.3)
- printLine(27,12," O ")
- sleep(0.3)
- printLine(27,12,"O O")
- sleep(0.3)
- printLine(27,12," O ")
- sleep(0.5)
- end
- function drawScreen()
- w, h = term.getSize()
- printLine(1,1,"+-----------------------------------------------+")
- printLine(1,2,"| |")
- printLine(1,3,"| |")
- printLine(1,4,"| |")
- printLine(1,5,"| |")
- printLine(1,6,"| |")
- printLine(1,7,"| |")
- printLine(1,8,"| |")
- printLine(1,9,"| |")
- printLine(1,10,"| |")
- printLine(1,11,"| |")
- printLine(1,12,"| |")
- printLine(1,13,"| |")
- printLine(1,14,"| |")
- printLine(1,15,"| |")
- printLine(1,16,"| |")
- printLine(1,17,"+-----------------------------------------------+")
- printLine(3,2,"BlueTunes version "..version)
- printLine(w-(string.len(copyrightText)+2),16,copyrightText)
- end
- --end
- --programs functions
- function menu()
- while true do
- clear()
- drawScreen()
- menuOptions = {
- "";
- "";
- "";
- "| 1.Run Music Player";
- "| 2.Settings";
- "| 3.Shutdown";
- "| 4.Exit";
- }
- for i = 1,#menuOptions do
- printLine(1,0+i,menuOptions[i])
- end
- printLine(3,menuSelected+3,">")
- event, key = os.pullEvent()
- if key == 200 and menuSelected > 1 then
- menuSelected = menuSelected-1
- elseif key == 208 and menuSelected < 4 then
- menuSelected = menuSelected+1
- elseif key == 14 then
- clear()
- break
- elseif key == 28 and menuSelected == 1 then
- music_player()
- elseif key == 28 and menuSelected == 2 then
- music_settings()
- elseif key == 28 and menuSelected == 3 then
- os.shutdown()
- elseif key == 28 and menuSelected == 4 then
- clear()
- break
- end
- end
- end
- function music_player()
- while true do
- clear()
- drawScreen()
- printLine(2,2," ")
- printLine(25,16," ")
- printLine(1,11,"+-----------------------------------------------+")
- printLine(1,3,"| OOO O O O OOOO OOOO OOOO OOO OOOO |")
- printLine(1,4,"| O O O O O O OO OO O O O |")
- printLine(1,5,"| OOOO O O O OOOO OO OO O O OOOO |")
- printLine(1,6,"| O O O O O O OO OO O O O |")
- printLine(1,7,"| OOO OOOO OOO OOOO OO OOOO OOO OOOO |")
- printLine((w/2)-(14/2),9,"music player")
- if musicPlaying == false then
- printLine(1,13,"| \\/\\/ +--+ |\\ +---+ ---- |")
- printLine(1,14,"| <()> | | | > |-->| EXIT |")
- printLine(1,15,"| /\\/\\ +--+ |/ +---+ ---- |")
- elseif musicPlaying == true then
- printLine(1,13,"| \\/\\/ +--+ || || +---+ ---- |")
- printLine(1,14,"| <()> | | || || |-->| EXIT |")
- printLine(1,15,"| /\\/\\ +--+ || || +---+ ---- |")
- end
- if musicSelected == 1 then
- printLine(4,16,"settings")
- printLine(5,13,"[") printLine(10,13,"]")
- printLine(5,14,"[") printLine(10,14,"]")
- printLine(5,15,"[") printLine(10,15,"]")
- elseif musicSelected == 2 then
- printLine(13,16,"stop")
- printLine(12,13,"[") printLine(17,13,"]")
- printLine(12,14,"[") printLine(17,14,"]")
- printLine(12,15,"[") printLine(17,15,"]")
- elseif musicSelected == 3 then
- if musicPlaying == true then
- printLine(21,16,"pause")
- else
- printLine(21,16,"play")
- end
- printLine(20,13,"[") printLine(26,13,"]")
- printLine(20,14,"[") printLine(26,14,"]")
- printLine(20,15,"[") printLine(26,15,"]")
- elseif musicSelected == 4 then
- printLine(30,16,"eject")
- printLine(29,13,"[") printLine(35,13,"]")
- printLine(29,14,"[") printLine(35,14,"]")
- printLine(29,15,"[") printLine(35,15,"]")
- elseif musicSelected == 5 then
- printLine(39,16,"exit")
- printLine(38,13,"[") printLine(43,13,"]")
- printLine(38,14,"[") printLine(43,14,"]")
- printLine(38,15,"[") printLine(43,15,"]")
- end
- event, key = os.pullEvent()
- if key == 203 and musicSelected > 1 then
- musicSelected = musicSelected-1
- elseif key == 205 and musicSelected < 5 then
- musicSelected = musicSelected+1
- elseif key == 14 then
- disk.stopAudio(mountPath)
- musicPlaying = false
- musicDiskIn = false
- break
- elseif key == 28 and musicSelected == 1 then
- music_settings()
- elseif key == 28 and musicSelected == 2 and musicPlaying == true then
- disk.stopAudio()
- musicPlaying = false
- elseif key == 28 and musicSelected == 3 and musicPlaying == true then
- disk.stopAudio(mountPath)
- musicPlaying = false
- elseif key == 28 and musicSelected == 3 and musicPlaying == false and musicDiskIn == true then
- disk.playAudio(mountPath)
- musicPlaying = true
- elseif key == 28 and musicSelected == 3 and musicPlaying == false and musicDiskIn == false then
- printLine(2,10,"No Disk Mounted! Go to settings to mount a disk")
- sleep(2)
- elseif key == 28 and musicSelected == 4 then
- disk.eject("left") disk.eject("right") disk.eject("top") disk.eject("bottom") disk.eject("back") disk.eject("front")
- musicPlaying = false
- musicDiskIn = false
- elseif key == 28 and musicSelected == 5 then
- musicPlaying = false
- disk.stopAudio(mountPath)
- musicDiskIn = false
- break
- end
- end
- end
- function music_settings()
- while true do
- clear()
- drawScreen()
- settingOptions = {
- "| 1.Insert/Mount Disk";
- "| 2.Change Mount Path-currently set to "..mountPath;
- "| 3.Go Back"
- }
- for i = 1,#settingOptions do
- printLine(1,3+i,settingOptions[i])
- end
- printLine(3,settingSelected+3,">")
- printLine(3,16,settingSelected)
- event, key = os.pullEvent()
- if key == 200 and settingSelected > 1 then
- settingSelected = settingSelected-1
- elseif key == 208 and settingSelected < 3 then
- settingSelected = settingSelected+1
- elseif key == 14 then
- break
- elseif key == 28 and settingSelected == 1 then
- if disk.hasAudio(mountPath) == true then
- musicDiskIn = true
- printLine(3,8,"disk mounted...you can now play the disk")
- sleep(1)
- else
- printLine(3,8,"no audio found in "..mountPath)
- sleep(1)
- end
- elseif key == 28 and settingSelected == 2 then
- printLine(3,8,"Change mount path to?")
- term.setCursorPos(3,9)
- mountPathNew = read()
- if mountPathNew == "top" or mountPathNew == "bottom" or mountPathNew == "left" or mountPathNew == "right" or mountPathNew == "back" or mountPathNew == "front" then
- printLine(3,10,"New mount path accepted")
- mountPath = mountPathNew
- sleep(1)
- musicDiskIn = false
- else
- printLine(3,10,"Invalid side")
- sleep(1)
- end
- elseif key == 28 and settingSelected == 3 then
- break
- end
- end
- end
- --end
- --variables
- copyrightText = "[C] Bluetide Programs"
- version = "1.0.0"
- menuSelected = 1
- musicPlaying = false
- musicSelected = 3
- musicDiskIn = false
- settingSelected = 1
- mountPath = "bottom"
- --end
- --code
- --startup()
- menu()
- --end
Advertisement
Add Comment
Please, Sign In to add comment