diff --git a/kitchen.aseprite b/kitchen.aseprite index af1e1e2..6b8556e 100644 Binary files a/kitchen.aseprite and b/kitchen.aseprite differ diff --git a/l5-mockup/images/bg.png b/l5-mockup/images/bg.png new file mode 100644 index 0000000..418da6d Binary files /dev/null and b/l5-mockup/images/bg.png differ diff --git a/l5-mockup/images/pads_001.png b/l5-mockup/images/pads_001.png new file mode 100644 index 0000000..276f760 Binary files /dev/null and b/l5-mockup/images/pads_001.png differ diff --git a/l5-mockup/images/pads_002.png b/l5-mockup/images/pads_002.png new file mode 100644 index 0000000..851e3f6 Binary files /dev/null and b/l5-mockup/images/pads_002.png differ diff --git a/l5-mockup/main.lua b/l5-mockup/main.lua index e2f7ff7..bee579c 100644 --- a/l5-mockup/main.lua +++ b/l5-mockup/main.lua @@ -1,14 +1,66 @@ require("L5") +local bgImg +local pads = { + ["S1"] = { 98, 25, 68, 48, img = 1 }, + ["S2"] = { 175, 25, 68, 48, img = 1 }, + ["S3"] = { 98, 83, 68, 48, img = 1 }, + ["S4"] = { 175, 83, 68, 48, img = 1 }, + ["C1"] = { 262, 23, 71, 110, img = 1 }, + ["W1"] = { 346, 60, 79, 84, img = 1 }, + ["F1"] = { 0, 0, 47, 159, img = 1 }, + ["F2"] = { 0, 162, 129, 29, img = 1 }, + ["A1"] = { 282, 202, 90, 58, img = 1 }, + ["A2"] = { 376, 202, 90, 58, img = 1 }, + ["A3"] = { 284, 262, 90, 58, img = 1 }, + ["A4"] = { 413, 260, 67, 60, img = 1 }, +} +local selectedKeyPad = "S1" +local padScrollOrder = {} +-- TODO: replace this with ideal scroll order +for key, _ in pairs(pads) do + table.insert(padScrollOrder, key) +end + function setup() size(480, 320) -- the size of the LCD screen windowTitle("Kitchen Timer Mockup") -- Sets print command output to display in window printToScreen() describe('Draws a yellow background!!!!') + bgImg = loadImage('images/bg.png') + local padsImg1 = loadImage('images/pads_001.png') + local padsImg2 = loadImage('images/pads_002.png') + for _, pad in pairs(pads) do + if pad.img == 1 then + pad.img = padsImg1 + elseif pad.img == 2 then + pad.img = padsImg2 + end + end +end + +local function drawPad(padId) + local pad = pads[padId] + if pad then + copy(pad.img, pad[1], pad[2], pad[3], pad[4], pad[1], pad[2], pad[3], pad[4]) + end end function draw() - -- Fills the background with the color yellow - background(255, 215, 0) + image(bgImg, 0, 0) + drawPad(selectedKeyPad) +end + +local padScrollIndex = 1 +function mouseWheel(upDown) + local scrollDirection = upDown == 1 and "up" or "down" + if scrollDirection == "up" and padScrollIndex == #padScrollOrder then + padScrollIndex = 1 + elseif scrollDirection == "down" and padScrollIndex == 1 then + padScrollIndex = #padScrollOrder + else + padScrollIndex = padScrollIndex + (scrollDirection == "up" and 1 or -1) + end + selectedKeyPad = padScrollOrder[padScrollIndex] end