Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local w,h = term.getSize()
- local f=fs.open("/C/system/RAM/user","r")
- user=f.readLine()
- f.close()
- if fs.exists("/C/system/Users/"..user.."/colors") then
- nastaveni={barva=colors.blue}
- f=fs.open("/C/system/Users/"..user.."/colors","r")
- cnt=f.readAll()
- f.close()
- nastaveni=textutils.unserialize(cnt)
- f=fs.open("/C/system/Users/"..user.."/textcol","r")
- tnt=f.readAll()
- f.close()
- text=textutils.unserialize(tnt)
- else
- f=fs.open("/C/system/.core/colors","r")
- cnt=f.readAll()
- f.close()
- nastaveni=textutils.unserialize(cnt)
- f=fs.open("/C/system/.core/textcol","r")
- tnt=f.readAll()
- f.close()
- text=textutils.unserialize(tnt)
- end
- local function prc(text, y)
- local w = term.getSize()
- local _, cy = term.getCursorPos()
- term.setCursorPos(math.ceil((w-#text)/2), y or cy)
- write(text)
- end
- function prehravac ()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(19,1)
- prc ("Media Player")
- term.setTextColor(colors.black)
- term.setCursorPos(5,8)
- term.setBackgroundColor(colors.yellow)
- term.setTextColor(colors.black)
- print" Play "
- term.setCursorPos(41,8)
- print" Stop "
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- error()
- break
- end
- if xy == "6,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "7,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "8,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "9,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "10,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "11,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "12,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "45,8" and button == 1 then
- print("Stop")
- disk.stopAudio("left")
- disk.stopAudio("right")
- disk.stopAudio("bottom")
- prehravac ()
- break
- end
- if xy == "42,8" and button == 1 then
- print("Stop")
- disk.stopAudio("left")
- disk.stopAudio("right")
- disk.stopAudio("bottom")
- prehravac ()
- break
- end
- if xy == "43,8" and button == 1 then
- print("Stop")
- disk.stopAudio("left")
- disk.stopAudio("right")
- disk.stopAudio("bottom")
- prehravac ()
- break
- end
- if xy == "44,8" and button == 1 then
- print("Stop")
- disk.stopAudio("left")
- disk.stopAudio("right")
- disk.stopAudio("bottom")
- prehravac ()
- break
- end
- end
- end
- prehravac ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement