diff --git a/README.md b/README.md index 709b658..ce81079 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,24 @@ # Rhythmblock -a graphical music player for ComputerCraft +![Rhythmblock playing Cat by C418](screenshot.png) +a graphical, customizable music player for ComputerCraft -## WIP +## Features -as of now this is not finished, but fast progress is being made! +- easily customizable +- compatible with all placeable computers and all monitors +- keyboard support +- eject discs directly from the player +- status bar + +## Keyboard Shortcuts + +space - play/stop +e - eject +q - quit + +## Install + +run the following on the desired CC computer + +`wget https://fem.mint.lgbt/m/Rhythmblock/raw/branch/master/rhythmblock.lua Rhythmblock` diff --git a/rhythmblock.lua b/rhythmblock.lua index be27901..8c424de 100644 --- a/rhythmblock.lua +++ b/rhythmblock.lua @@ -142,25 +142,25 @@ buttonRender(false) status = defaultStatus -- Setting the value to the default while true do - statusRender(status) + statusRender(status) -- Renders the status local eventData = {os.pullEvent()} local event = eventData[1] - if event == "mouse_up" then - if eventData[2] == 1 and eventData[3] >= centerWidth - 4 and eventData[4] >= centerHeight - 4 and eventData[3] <= centerWidth + 4 and eventData[4] <= centerHeight + 2 then + if event == "mouse_up" then -- If the event triggered is the mouse clicking it'll do what's next + if eventData[2] == 1 and eventData[3] >= centerWidth - 4 and eventData[4] >= centerHeight - 4 and eventData[3] <= centerWidth + 4 and eventData[4] <= centerHeight + 2 then -- If the user clicks on the play/stop button it'll begin playing the disc if playing == true then stopDisc() else playDisc() end - elseif eventData[2] == 1 and eventData[3] >= centerWidth - 2 and eventData[4] >= centerHeight + 4 and eventData[3] <= centerWidth + 2 and eventData[4] <= centerHeight + 4 then + elseif eventData[2] == 1 and eventData[3] >= centerWidth - 2 and eventData[4] >= centerHeight + 4 and eventData[3] <= centerWidth + 2 and eventData[4] <= centerHeight + 4 then -- If the user clicks on the eject button it'll eject the disc ejectDisc() - elseif eventData[2] == 1 and eventData[3] == width and eventData[4] == 1 then + elseif eventData[2] == 1 and eventData[3] == width and eventData[4] == 1 then -- If the user presses the X it'll quit term.clear() term.setCursorPos(1, 1) return true end - elseif event == "key_up" then + elseif event == "key_up" then -- Same order but now with keys local name = keys.getName(eventData[2]) or "unknown key" if name == "space" then if playing == true then diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..67ad426 Binary files /dev/null and b/screenshot.png differ