diff --git a/apps/Uke/ChangeLog b/apps/Uke/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/Uke/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/Uke/README.md b/apps/Uke/README.md new file mode 100644 index 000000000..49ceea1ed --- /dev/null +++ b/apps/Uke/README.md @@ -0,0 +1,11 @@ +# Uke Chords + +An app that simply describes finger placements on a Ukulele to form common chords. + +## Usage + +Use the button to scroll through the available chords. + +## Creator + +NovaDawn999 diff --git a/apps/Uke/app-icon.js b/apps/Uke/app-icon.js new file mode 100644 index 000000000..17b77ab32 --- /dev/null +++ b/apps/Uke/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwgtqiAXWiMRDKsBolBCqcQilEoQwTiMUoMkkJGUiQwUFwVCGCcUoVEkJ5SgJ2CAQMROyIsBoVDoIXQgMSiJ2EPB4uBdwMieCMBCoIZCDoJdQAAMSUYUBLqIXBIhxCBCAJdDIZwPBTgIAEFxrOCAAIuTCwVELoQuToIuRgIuDCoUiFxjNCFwq7BC5YWBFoZdDAQIXLCwpdEogXKLYgWBXYZ9BC5SKDCwQYCkIHBC5IuFFQIYBiQhCC5JdFCoIYBBIYXJIwlEFwUUBIYXOLgIYDA4ReJC4i4BI4RODOxj/CAQIyBFwSOMoIYCagQ4BCxQXEigrBiS7CLpRHGAIMiMwYXMQoYwCSogXKU4gwCC6gwCC6ApEUoIFDRxR4Fd4QXReAgcEC5hIFLyAwJFxwwIiIWODATbDCyIYCAAQWSACY")) diff --git a/apps/Uke/app.js b/apps/Uke/app.js new file mode 100644 index 000000000..c60c49a6b --- /dev/null +++ b/apps/Uke/app.js @@ -0,0 +1,131 @@ +const stringInterval = 30; +const stringLength = 131; +const fretHeight = 35; +const fingerOffset = 17; +const x = 44; +const y = 32; + +//chords +const cc = [ + "C", + "x", + "x", + "x", + "33" +]; + +const dd = [ + "D", + "23", + "22", + "24", + "x" +]; + +const gg = [ + "G", + "x", + "21", + "33", + "22", +]; + +const am = [ + "Am", + "22", + "x", + "x", + "x" +]; + +const em = [ + "Em", + "x", + "43", + "32", + "21" +]; + +const aa = [ + "A", + "22", + "11", + "x", + "x" +]; + +const ff = [ + "F", + "22", + "x", + "11", + "x" +]; + +var ee = [ + "E", + "33", + "32", + "34", + "11" +]; + +var index = 0; +var chords = []; + +function init() { + g.setFontAlign(0,0); // center font + g.setFont("6x8",2); // bitmap font, 8x magnified + chords.push(cc, dd, gg, am, em, aa, ff, ee); +} + +function drawBase() { + for (let i = 0; i < 4; i++) { + g.drawLine(x + i * stringInterval, y, x + i * stringInterval, y + stringLength); + g.fillRect(x- 1, y + i * fretHeight - 1, x + stringInterval * 3 + 1, y + i * fretHeight + 1); + } +} + +function drawChord(chord) { + g.drawString(chord[0], g.getWidth() * 0.5 + 2, 18); + for (let i = 0; i < chord.length; i++) { + if (i === 0 || chord[i][0] === "x") { + continue; + } + if (chord[i][0] === "0") { + g.drawString(chord[i][1], x + (i - 1) * stringInterval + 1, y + fretHeight * chord[i][0], true); + g.drawCircle(x + (i - 1) * stringInterval -1, y + fretHeight * chord[i][0], 8); + } + else { + g.drawString(chord[i][1], x + (i - 1) * stringInterval + 1, y -fingerOffset + fretHeight * chord[i][0], true); + g.drawCircle(x + (i - 1) * stringInterval -1, y -fingerOffset + fretHeight * chord[i][0], 8); + } + } +} + +function buttonPress() { + setWatch(() => { + buttonPress(); + }, BTN); + index++; + if (index >= chords.length) { index = 0; } + draw(); +} + +function draw() { + g.clear(); + drawBase(); + drawChord(chords[index]); +} + + + +function main() { + init(); + draw(); + setWatch(() => { + buttonPress(); + }, BTN); +} + +main(); diff --git a/apps/Uke/app.png b/apps/Uke/app.png new file mode 100644 index 000000000..7a6dd67ea Binary files /dev/null and b/apps/Uke/app.png differ diff --git a/apps/Uke/metadata.json b/apps/Uke/metadata.json new file mode 100644 index 000000000..10c3b3e79 --- /dev/null +++ b/apps/Uke/metadata.json @@ -0,0 +1,14 @@ +{ "id": "Uke", + "name": "Uke Chords", + "shortName":"Uke", + "version":"0.01", + "description": "Wrist mounted ukulele chords", + "icon": "app.png", + "tags": "uke, chords", + "supports" : ["BANGLEJS2"], + "readme": "README.md", + "storage": [ + {"name":"Uke.app.js","url":"app.js"}, + {"name":"Uke.img","url":"app-icon.js","evaluate":true} + ] +}