From 2f1342eebc410b28933fa5fb4ffc82ec3916b9ee Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:30:12 +0200 Subject: [PATCH] Create app.js --- apps/widday/app.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 apps/widday/app.js diff --git a/apps/widday/app.js b/apps/widday/app.js new file mode 100644 index 000000000..a244098f5 --- /dev/null +++ b/apps/widday/app.js @@ -0,0 +1,27 @@ +(() => { + var width = 32; // width of the widget + + function draw() { + var date = new Date(); + g.reset(); // reset the graphics context to defaults (color/font/etc) + g.setFontAlign(0,1); // center fonts + //g.drawRect(this.x, this.y, this.x+width-1, this.y+23); // check the bounds! + + var text = "date.getDate(); + g.setFont("Vector", 24); + g.drawString(text, this.x+width/2+1, this.y + 28); + //g.setColor(0, 0, 1); + //g.drawRect(this.x, this.y, this.x+width-2, this.y+1); + } + + setInterval(function() { + WIDGETS["widdateday"].draw(WIDGETS["widdateday"]); + }, 10*60000); // update every 10 minutes + + // add your widget + WIDGETS["widdateday"]={ + area:"bl", // tl (top left), tr (top right), bl (bottom left), br (bottom right) + width: width, // how wide is the widget? You can change this and call Bangle.drawWidgets() to re-layout + draw:draw // called to draw the widget + }; +})()