From 327b43f4f77ec2411afb864390a9bae6fc32bd05 Mon Sep 17 00:00:00 2001 From: IgorTimofeev Date: Sat, 30 Dec 2023 11:50:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=203?= =?UTF-8?q?=20=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B0=20=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=D1=80?= =?UTF-8?q?=D0=B5=D0=BC=D0=B5=D0=BD=D0=B8=20=D1=82=D1=80=D0=B5=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications/Pioneer.app/Main.lua | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/Applications/Pioneer.app/Main.lua b/Applications/Pioneer.app/Main.lua index 375aa649..4252d6df 100644 --- a/Applications/Pioneer.app/Main.lua +++ b/Applications/Pioneer.app/Main.lua @@ -24,7 +24,7 @@ else tapes = { }, - lastTape = nil + timeMode = 0 } end @@ -32,6 +32,9 @@ local function saveConfig() filesystem.writeTable(configPath, config) end +-- Older versions support +config.timeMode = config.timeMode or 0 + -------------------------------------------------------------------------------- local function loadImage(name) @@ -286,10 +289,11 @@ overlay.draw = function(overlay) screen.drawText(statsX, statsY + 1, 0xE1E1E1, string.format("%02d", tapeIndex)) -- Time - local timeSecondsTotal = position / (1500 * 4) + local timeSecondsTotal = (config.timeMode == 0 and position or (config.timeMode == 1 and tape.size - position or tape.size)) / (1500 * 4) local timeMinutes = math.floor(timeSecondsTotal / 60) local timeSeconds, timeMilliseconds = math.modf(timeSecondsTotal - timeMinutes * 60) - screen.drawText(statsX + 10, statsY + 1, 0xE1E1E1, string.format("%02d", timeMinutes) .. "m:" .. string.format("%02d", timeSeconds) .. "s".. string.format("%03d", math.floor(timeMilliseconds * 1000))) + local timeString = string.format("%02d", timeMinutes) .. "m:" .. string.format("%02d", timeSeconds) .. "s".. string.format("%03d", math.floor(timeMilliseconds * 1000)) + screen.drawText(statsX + 10, statsY + 1, 0xE1E1E1, config.timeMode == 1 and "-" .. timeString or timeString) -- Tempo screen.drawText(statsX + 24, statsY, 0xE1E1E1, "Tempo") @@ -588,8 +592,23 @@ end -------------------------------- Quantize/time buttons ------------------------------------------------ -local _ = window:addChild(newRoundTinyButton(14, 12, 0x0F0F0F, 0xFF0000, 0x0F0F0F, 0xFF0000, "⢠⡄")) -local _ = window:addChild(newRoundTinyButton(18, 12, 0x0F0F0F, 0x2D2D2D, 0x0F0F0F, 0x2D2D2D, "⢠⡄")) +local _ = window:addChild(newRoundTinyButton(14, 12, 0x0F0F0F, 0xFF0000, 0x0, 0x440000, "⢠⡄")) + +local timeModeButton = window:addChild(newRoundTinyButton(18, 12, 0x0F0F0F, 0x1E1E1E, 0x0, 0x0F0F0F, "⢠⡄")) +timeModeButton.onTouch = function() + if not tape or not powerButton.pressed then + return + end + + config.timeMode = config.timeMode + 1 + + if config.timeMode > 2 then + config.timeMode = 0 + end + + workspace:draw() + saveConfig() +end -------------------------------- Needle search ------------------------------------------------