mirror of https://github.com/espruino/BangleApps
parent
855f196fd3
commit
c5b21bf64d
|
@ -72,12 +72,28 @@ var ee = [
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var chords = [];
|
var chords = [];
|
||||||
|
var menu = {
|
||||||
|
"" : {
|
||||||
|
"title" : "Uke Chords"
|
||||||
|
},
|
||||||
|
"C" : function() { draw(cc); },
|
||||||
|
"D" : function() { draw(dd); },
|
||||||
|
"E" : function() { draw(ee); },
|
||||||
|
"Em" : function() { draw(em); },
|
||||||
|
"A" : function() { draw(aa); },
|
||||||
|
"Am" : function() { draw(am); },
|
||||||
|
"F" : function() { draw(ff); },
|
||||||
|
"G" : function() { draw(gg); },
|
||||||
|
"About" : function() {
|
||||||
|
E.showMessage(
|
||||||
|
"Created By:\nNovaDawn999", {
|
||||||
|
title:"About"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
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() {
|
function drawBase() {
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
|
@ -87,18 +103,18 @@ function drawBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawChord(chord) {
|
function drawChord(chord) {
|
||||||
g.drawString(chord[0], g.getWidth() * 0.5 + 2, 18);
|
g.drawString(chord[0], g.getWidth() * 0.5 - 3, 18);
|
||||||
for (let i = 0; i < chord.length; i++) {
|
for (let i = 0; i < chord.length; i++) {
|
||||||
if (i === 0 || chord[i][0] === "x") {
|
if (i === 0 || chord[i][0] === "x") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (chord[i][0] === "0") {
|
if (chord[i][0] === "0") {
|
||||||
g.drawString(chord[i][1], x + (i - 1) * stringInterval + 1, y + fretHeight * chord[i][0], true);
|
g.drawString(chord[i][1], x + (i - 1) * stringInterval - 5, y + fretHeight * chord[i][0] + 2, true);
|
||||||
g.drawCircle(x + (i - 1) * stringInterval -1, y + fretHeight * chord[i][0], 8);
|
g.drawCircle(x + (i - 1) * stringInterval -1, y + fretHeight * chord[i][0], 10);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g.drawString(chord[i][1], x + (i - 1) * stringInterval + 1, y -fingerOffset + fretHeight * chord[i][0], true);
|
g.drawString(chord[i][1], x + (i - 1) * stringInterval -5, y -fingerOffset + fretHeight * chord[i][0] + 2, true);
|
||||||
g.drawCircle(x + (i - 1) * stringInterval -1, y -fingerOffset + fretHeight * chord[i][0], 8);
|
g.drawCircle(x + (i - 1) * stringInterval -1, y -fingerOffset + fretHeight * chord[i][0], 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,22 +123,19 @@ function buttonPress() {
|
||||||
setWatch(() => {
|
setWatch(() => {
|
||||||
buttonPress();
|
buttonPress();
|
||||||
}, BTN);
|
}, BTN);
|
||||||
index++;
|
E.showMenu(menu);
|
||||||
if (index >= chords.length) { index = 0; }
|
|
||||||
draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function draw() {
|
function draw(chord) {
|
||||||
g.clear();
|
g.clear();
|
||||||
drawBase();
|
drawBase();
|
||||||
drawChord(chords[index]);
|
drawChord(chord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
init();
|
E.showMenu(menu);
|
||||||
draw();
|
|
||||||
setWatch(() => {
|
setWatch(() => {
|
||||||
buttonPress();
|
buttonPress();
|
||||||
}, BTN);
|
}, BTN);
|
||||||
|
|
Loading…
Reference in New Issue