diff --git a/apps.json b/apps.json index 00231a835..0a047551e 100644 --- a/apps.json +++ b/apps.json @@ -1514,5 +1514,25 @@ "data": [ {"name": "ballmaze.json"} ] - } + }, + { + "id": "counter", + "name": "Counter", + "icon": "counter_icon.png", + "version": "0.01", + "description": "Simple counter", + "tags": "tool", + "allow_emulator": true, + "storage": [ + { + "name": "counter.app.js", + "url": "counter.js" + }, + { + "name": "counter.img", + "url": "counter-icon.js", + "evaluate": true + }, + ] + }, ] diff --git a/apps/counter/ChangeLog b/apps/counter/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/counter/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/counter/counter-icon.js b/apps/counter/counter-icon.js new file mode 100644 index 000000000..e894b2622 --- /dev/null +++ b/apps/counter/counter-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwhC/ACcRiAWViURCycBj//+IwTgMv//yC63zC5sBiIAEI4QIFDo8SmYADmURmcRkYJEkIuGBooOBSAIIFmYwFgINGABIwFEo4XqmUiABJtCC46KBABYYBC48xF5gPBC48ikIPCiQDCkIIBAwMhC5ESdQIABkYDCmXx/8v+MxC7URbQQXEmYXCAYIXHgJ9BC4vxkUvkfyAYMy+X/BQIXCkMjmIXGB4MjAYUy+cRF4kxl4XOMYQXESgIXl+cSI4oMBO50/O4siL4ynH+cjU5rXHC4zXJC4y/BC4oADC4J9BkQABiQDCLAQGBkIXIkMyCYQAHkYPCC40yMwIAKkYXIDAIvLBwIXIABwXdgIJCIhEyC5RRBmJzHiUhicTC4LUCJCYuFGASmMAAIuGAH4A/AHo")) \ No newline at end of file diff --git a/apps/counter/counter.js b/apps/counter/counter.js new file mode 100644 index 000000000..3be3afb57 --- /dev/null +++ b/apps/counter/counter.js @@ -0,0 +1,29 @@ +var counter = 0; + +g.setColor(0xFFFF); + +function updateScreen() { + g.clearRect(0, 50, 250, 150); + g.setFont("Vector",40).setFontAlign(0,0); + g.drawString(Math.floor(counter), g.getWidth()/2, 100); +} + + +// add a count by using BTN1 +setWatch(() => { + counter += 1; + updateScreen(); +}, BTN1, {repeat:true}); + +setWatch(() => { + counter = 0; + updateScreen(); +}, BTN3, {repeat:true}); + +g.clear(1).setFont("6x8"); +g.drawString('Use BTN1 to increase\nthe counter by one.\nUse BTN3 to reset counter.', 25, 200); + +Bangle.loadWidgets(); +Bangle.drawWidgets(); + +// TODO: Enable saving count to file \ No newline at end of file diff --git a/apps/counter/counter_icon.png b/apps/counter/counter_icon.png new file mode 100644 index 000000000..e5e4009bf Binary files /dev/null and b/apps/counter/counter_icon.png differ diff --git a/apps/counter/counter_icon_100.png b/apps/counter/counter_icon_100.png new file mode 100644 index 000000000..67abe513f Binary files /dev/null and b/apps/counter/counter_icon_100.png differ