From 57268095307e723bb11983818ddb387fc35378b4 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 17:53:50 +0200 Subject: [PATCH 01/50] Create app.js --- apps/pongclock/app.js | 309 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 apps/pongclock/app.js diff --git a/apps/pongclock/app.js b/apps/pongclock/app.js new file mode 100644 index 000000000..8efe0eca5 --- /dev/null +++ b/apps/pongclock/app.js @@ -0,0 +1,309 @@ +class Ball { + constructor(collision) { + this.collision = collision; + this.w = 4; + this.h = this.w; + this.y = height / 2 - this.h / 2; + this.x = width / 2 - this.w / 2; + this.oldX = this.x; + this.oldY = this.y; + this.velX = 6; + this.velY = 3.5 + Math.random(); + } + + reset() { + this.y = height / 2 - this.h / 2; + this.x = width / 2 - this.w / 2; + this.velX = 6; + this.velY = 3.5 + Math.random(); + } + + checkCollision(that, isLeft) { + let test = false; + if (isLeft) { + test = this.x <= that.w + this.w && this.y > that.y && this.y < that.y + that.h; + } + else { + test = this.x >= that.x + this.w && this.y > that.y && this.y < that.y + that.h; + } + if (test) { + this.velX = -this.velX; + this.valY = (3.5 + Math.random()) * this.valY / Math.abs(this.valY); + + if (isLeft) { + right.follow = this; + left.follow = null; + } else { + left.follow = this; + right.follow = null; + } + } + } + + move() { + if (this.velX > 0) { + this.checkCollision(right, false); + } else { + this.checkCollision(left, true); + } + + this.x += this.velX; + this.y += this.velY; + + if (this.y <= this.h) { + this.y = this.h; + this.velY = -this.velY; + } + + if (this.y >= height - this.h) { + this.y = height - this.h; + this.velY = -this.velY; + } + + if(this.x >= width) { + left.scored(); + restart(); + } else if(this.x < 0) { + right.scored(); + restart(); + } + + } +} + +class Paddle { + constructor(side) { + this.side = side; + this.w = 4;//15; + this.h = 30;//80; + this.y = height / 2 - this.h/2; + this.follow = null; + this.target = height / 2 - this.h/2; + this.score = 99; + this.hasLost = false; + } + + reset() { + this.follow = null; + this.hasLost = false; + this.target = height / 2 - this.h/2; + this.y = height / 2 - this.h/2; + this.move(); + } + + scored() { + let d = new Date(); + let value = 0; + if (this.side == "left") { + value = d.getHours(); + } else { + value = d.getMinutes(); + } + if (this.score < value) { + this.score++; + } + else { + this.score = value; + } + } + + move() { + + if (this.follow && ! this.hasLost) { + var dy = this.follow.y - this.y - this.h / 2; + this.y += dy / 2; + } + else { + this.y += (this.target - this.y) / 10; + } + if (this.y < 0) { + this.y = 0; + } + if (this.y > height - this.h) { + this.y = height - this.h; + } + } +} + +var updateTimeout = null; +function update() { + var d = new Date(); + var lastStep = Date.now(); + left.move(); + right.move(); + if(d.getHours() != left.score) { + right.follow = null; + right.hasLost = true; + } + if(d.getMinutes() != right.score) { + left.follow = null; + left.hasLost = true; + } + + ball.move(); + redraw(); + var nextStep = 40 - (Date.now() - lastStep); + //console.log(nextStep); + updateTimeout = setTimeout(update, nextStep > 0 ? nextStep : 0); + return lastStep; +} + +function redraw() { + let fontHeight = width / 3.6; + let fontTop = top + height / 11; + let topHeight = top + height; + g.reset(); + + if (settings.isInvers) { + g.setColor(g.theme.bg); + g.setBgColor(g.theme.fg); + } + + g.clearRect(0, top + left.oldY, left.w, top + left.oldY + left.h); + g.clearRect(width - right.w, top + right.oldY, width, top + right.oldY + right.h); + g.clearRect(width / 2 - fontHeight * 1.4, fontTop, width / 2 + fontHeight * 1.4, fontTop + fontHeight); + g.clearRect(ball.oldX - ball.w, top + ball.oldY - ball.h, ball.oldX + ball.w, top + ball.oldY + ball.h); + + g.drawLine(width / 2, top, width / 2, topHeight); + g.fillRect(0, top + left.y, left.w, top + left.y + left.h); + left.oldY = left.y; + g.fillRect(width - right.w, top + right.y, width, top + right.y + right.h); + right.oldY = right.y; + g.fillCircle(ball.x, top + ball.y, ball.w); + ball.oldX = ball.x; + ball.oldY = ball.y; + + g.setFontVector(fontHeight); + /* + g.setFontAlign(0, -1); + g.drawString(("0" + left.score).substr(-2)+ " " + ("0" + right.score).substr(-2), width / 2, fontTop); + */ + /**/ + g.setFontAlign(1, -1); + g.drawString(("0" + left.score).substr(-2), 5 * width / 11, fontTop); + g.setFontAlign(-1, -1); + g.drawString(("0" + right.score).substr(-2), 6 * width / 11, fontTop); + /**/ +} + +function restart() { + g.reset(); + if (settings.isInvers) { + g.setColor(g.theme.bg); + g.setBgColor(g.theme.fg); + } + g.clearRect(0, top, width, top + height); + ball.reset(); + left.reset(); + right.reset(); + right.follow = ball; + left.move(); + right.move(); + if (settings.withWidgets) { + Bangle.drawWidgets(); + } +} + +function stop() { + if (updateTimeout) { + clearTimeout(updateTimeout); + } + updateTimeout = null; + if (pauseTimeout) { + clearTimeout(pauseTimeout); + } + pauseTimeout = null; +} + +var pauseTimeout = null; +function pause() { + stop(); + left.scored(); + right.scored(); + redraw(); + pauseTimeout = setTimeout(pause, Date.now() % 60000); +} + +const SETTINGS_FILE = "pongclock.json"; +var settings = Object.assign({ + // default values + withWidgets: true, + isInvers: false, + playLocked: true, +}, require('Storage').readJSON(SETTINGS_FILE, true) || {}); +require('Storage').writeJSON(SETTINGS_FILE, settings); + +var height = g.getHeight(), + width = g.getWidth(); +var top = 0; + +Bangle.setUI("clock"); + +g.reset(); +g.clearRect(0, top, width, height); + +if (settings.withWidgets) { + Bangle.loadWidgets(); + Bangle.drawWidgets(); + //console.log(WIDGETS); + if (global.WIDGETS) { + let bottom = 0; + for (var i in WIDGETS) { + var w = WIDGETS[i]; + if (w.area) { + if (w.area.indexOf("t") >= 0) { + top = 25; + } + if (w.area.indexOf("b") >= 0) { + bottom = 25; + } + } + } + height -= top + bottom; + } +} + +if (settings.isInvers) { + g.setColor(g.theme.bg); + g.setBgColor(g.theme.fg); +} +g.clearRect(0, top, width, top + height); + +var left = new Paddle("left"); +var right = new Paddle("right"); +var ball = new Ball(true); + +left.x = 20; +right.x = width - 20; + +left.scored(); +right.scored(); + +Bangle.on("lock", (on) => { + //console.log(on); + if (!settings.playLocked) { + if (on) { + pause(); + } else { + stop(); + update(); + } + } +}); + +restart(); +if (!settings.playLocked && Bangle.isLocked()) { + pause(); +} else { + update(); +} + +/* +require("Storage").write("pongclock.info",{ + "id":"pongclock", + "name":"Pong Clock", + "type":"clock", + "src":"pongclock.app.js", + "icon":"pongclock.img" +}); +*/ From 0e45f63f4005e74cc7526f95e2a1718a8e411dfc Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 17:59:55 +0200 Subject: [PATCH 02/50] Add files via upload --- apps/pongclock/pongclock.img | Bin 0 -> 1156 bytes apps/pongclock/pongclock.png | Bin 0 -> 933 bytes apps/pongclock/settings.js | 44 +++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 apps/pongclock/pongclock.img create mode 100644 apps/pongclock/pongclock.png create mode 100644 apps/pongclock/settings.js diff --git a/apps/pongclock/pongclock.img b/apps/pongclock/pongclock.img new file mode 100644 index 0000000000000000000000000000000000000000..e0045eff79314697cb8fe35138277dd0de433bc6 GIT binary patch literal 1156 zcmcJNQEtN^5JVR{|3>NoAie;oIRKaIft~mO+nI&fSg!w4BrD5fn4JJQ|J-CBy6kmd zeS~|FIW||+9AD~P(P(waoWEEPs(#X13znU#iH22uc#bQ5oO1`BaYG;BSLy%hW>&UNWPw3kNy2f@>t7EWdFER5bVG z&5e2n(S^Y8Rl8P2eYsG z1ffabKcYrr^Z%Q}gM*T7bd#<;i2j>z?}wod&9;Px#1ZP1_K>z@;j|==^1poj6O;Ai!MF0Q*|Ns9C3=AC|9V;s*Vk25RodFx=H}*fbaZ!jcLoLqtE=<#^L>4N zetv%5-rgoACR9{Z)YQ~=c6JyT7;bKEFE1~>y}j}A@qvMXgoK3a>+1sp1FfyC2L}fe z6BA};WVGd00H4iL_t(YOWl-bR}(=LK;K1@SSXg*3y3{puc#=X z7%O7$9cu#r|D*HXya}vHVD}t7$K(BwS9b60yxBdG&H$d}3v5jo2_D;yQ7oENzO z7n3l?CA)Z8SGq#g3de?4#<`k~^%_jXrc$Hknb8s^_3=@d@*Nr1;fAM15=LM;2{*%` z*12VUxy_xsF^eQ&fO}R2;l3Vf5@uSaOzf|8Uk@V7hb`rRZ1_6RbSVcd}A*sJs=~zg?CmdL5RE; z8Rmm`Gr}x<{1k{=`aGx9`7$S8VLV>Q3g2wOCErrOX80ca*7IP(kJxS(e#U-A$g back(), + 'Widgets?': { + value: !!settings.withWidgets, // !! converts undefined to false + format: v => v?"Show":"Hide", + onchange: v => { + settings.withWidgets = v; + writeSettings(); + } + }, + 'Inverted?': { + value: !!settings.isInvers, // !! converts undefined to false + format: v => v?"Yes":"No", + onchange: v => { + settings.withWidgets = v; + writeSettings(); + } + }, + 'On Lock?': { + value: !!settings.isInvers, // !! converts undefined to false + format: v => v?"Play":"Pause", + onchange: v => { + settings.withWidgets = v; + writeSettings(); + } + } + }); +})/*(load)/**/ \ No newline at end of file From a21898b7164306af1e152df4101e69ead1fc7eb1 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 18:02:50 +0200 Subject: [PATCH 03/50] Create ChangeLog --- apps/pongclock/ChangeLog | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/pongclock/ChangeLog diff --git a/apps/pongclock/ChangeLog b/apps/pongclock/ChangeLog new file mode 100644 index 000000000..e8c8518ae --- /dev/null +++ b/apps/pongclock/ChangeLog @@ -0,0 +1 @@ +0.1: First release From 36eea36a53431aaeb7db7442344148bfc23e17be Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 18:06:17 +0200 Subject: [PATCH 04/50] Create metadata.json --- apps/pongclock/metadata.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 apps/pongclock/metadata.json diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json new file mode 100644 index 000000000..13f8ff4f1 --- /dev/null +++ b/apps/pongclock/metadata.json @@ -0,0 +1,12 @@ +{ "id": "pongclock", + "name": "Pong Clock", + "shortName":"Pong Clock", + "icon": "pongclock.png", + "version":"0.1", + "description": "A clock playing Pong", + "tags": "", + "storage": [ + {"name":"pongclock.app.js","url":"app.js"}, + {"name":"pongclock.img","url":"pongclock-img.js","evaluate":true} + ] +} From 425c00cee195c712772b5c4e1d935ffd8d97567d Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 18:10:16 +0200 Subject: [PATCH 05/50] Create pongclock-icon.js --- apps/pongclock/pongclock-icon.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/pongclock/pongclock-icon.js diff --git a/apps/pongclock/pongclock-icon.js b/apps/pongclock/pongclock-icon.js new file mode 100644 index 000000000..00002a018 --- /dev/null +++ b/apps/pongclock/pongclock-icon.js @@ -0,0 +1 @@ +atob("MDCEBP//////////////AA//////////////////////////////AA//////////////////////////////AA//////////////////////////////AA//////////////////////////P///Ii//////////P////////zEAP/MQAC///////xAf//8xAAL/////8gAAP/AAAAL//////wAv//MAAAAv////8gEAPzAD8QD/Ii//8wA///IAPxAf////8S8APyAf8wD/AA//8gD///EB/yAP//////8APxAP8wD/AA//8AH///AB/yAf//////8AP///8gD/AA//MAP//////xAf//////8AP///8QH/AA//IA///////wAv//////8AP///MAP/AA//EB8AL///8gD///////8AP///EB//AA//AC8AL///8AL///////8AP//yAD//AA/zAD8AL///IA////////8AP//wAf//AA/xAP8AL//zAC////////8AP/8gA///Ii/wAf8AL//xAP///wAP//8AP/MAH/////8wABEAEf8wAv///wAP//8AP/EA//////8wAAAAAf8QD////wAP//8APzAB////Ii/yIiIAEvIAL////wAP//8APyAAAAD/AA////8AL/EAAAAP/wAP//8APyAAAAD/AA////8AL/EAAAAP/wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////Ii///////////////wAP///////////////////////////wAAAP///////////////////////////wAP//////////////Ii/////////////wAP//////8yP/////AA/////////////wAP//////EAAf////AA/////////////wAP/////zAAAD////AA/////////////wAP/////yAAAC////AA/////////////wAP/////zAAAD////AA/////////////wAP//////EAAf////AA/////////////wAP//////8yP/////AA/////////////wAP//////////////AA/////////////wAP//////////////Ii/////////////wAP/////////////////////////////wAP//////////////////////////////////////////////Ii//////////////////////////////AA//////////////////////////////AA//////////////////////////////AA//////////////////////////////AA///////////////w==") From 6db2bbcdb37f0eba036c92318c1b5948f4e43d18 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 18:10:54 +0200 Subject: [PATCH 06/50] Update metadata.json --- apps/pongclock/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json index 13f8ff4f1..a9e0240e6 100644 --- a/apps/pongclock/metadata.json +++ b/apps/pongclock/metadata.json @@ -7,6 +7,6 @@ "tags": "", "storage": [ {"name":"pongclock.app.js","url":"app.js"}, - {"name":"pongclock.img","url":"pongclock-img.js","evaluate":true} + {"name":"pongclock.img","url":"pongclock-icon.js","evaluate":true} ] } From 2b4ca3a2f7cc9e5577cc331afb6871cf0a204fdb Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 18:24:13 +0200 Subject: [PATCH 07/50] Create README.md --- apps/pongclock/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 apps/pongclock/README.md diff --git a/apps/pongclock/README.md b/apps/pongclock/README.md new file mode 100644 index 000000000..47883c56f --- /dev/null +++ b/apps/pongclock/README.md @@ -0,0 +1,2 @@ +**Pong Clock** +A clock that plays pong while the counter displays the time. From e7b4ecb3ccb7c7a2e96a4721e14f396b6fa2688f Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 18:29:35 +0200 Subject: [PATCH 08/50] Update metadata.json --- apps/pongclock/metadata.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json index a9e0240e6..3f35fddb0 100644 --- a/apps/pongclock/metadata.json +++ b/apps/pongclock/metadata.json @@ -5,8 +5,13 @@ "version":"0.1", "description": "A clock playing Pong", "tags": "", + "readme":"README.md", "storage": [ {"name":"pongclock.app.js","url":"app.js"}, - {"name":"pongclock.img","url":"pongclock-icon.js","evaluate":true} + {"name":"pongclock.img","url":"pongclock-icon.js","evaluate":true}, + {"name":"pongclock.settings.js","url":"settings.js"} + ], + "data": [ + {"name":"pongclock.json"} ] } From fc0f758073240a97c8ffd9f244f13d23f1036a81 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 18:31:26 +0200 Subject: [PATCH 09/50] Update metadata.json --- apps/pongclock/metadata.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json index 3f35fddb0..7ffb3e6dc 100644 --- a/apps/pongclock/metadata.json +++ b/apps/pongclock/metadata.json @@ -5,6 +5,7 @@ "version":"0.1", "description": "A clock playing Pong", "tags": "", + "supports": ["BANGLEJS2", "BANGLEJS2"], "readme":"README.md", "storage": [ {"name":"pongclock.app.js","url":"app.js"}, From 63f22684a1df68753d4725a585f6c70ae6bc052f Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 18:32:42 +0200 Subject: [PATCH 10/50] Update metadata.json --- apps/pongclock/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json index 7ffb3e6dc..9ce9fe291 100644 --- a/apps/pongclock/metadata.json +++ b/apps/pongclock/metadata.json @@ -5,7 +5,7 @@ "version":"0.1", "description": "A clock playing Pong", "tags": "", - "supports": ["BANGLEJS2", "BANGLEJS2"], + "supports": ["BANGLEJS", "BANGLEJS2"], "readme":"README.md", "storage": [ {"name":"pongclock.app.js","url":"app.js"}, From 9014dc0f4f63c6814bd22b9200f10188b27b7080 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 19:18:58 +0200 Subject: [PATCH 11/50] Update README.md --- apps/pongclock/README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/pongclock/README.md b/apps/pongclock/README.md index 47883c56f..cc152d7b9 100644 --- a/apps/pongclock/README.md +++ b/apps/pongclock/README.md @@ -1,2 +1,13 @@ -**Pong Clock** -A clock that plays pong while the counter displays the time. +# Pong Clock + +A clock which is playing Pong while showing the current time as score +* Settings + * Show or hide widgets (auto detecting the used widgets areas) + * Use inverted or standard theme colors for the play area + * Optionally pause while locked (saving battery) +* Loosely based on [https://codepen.io/Rabrennie/pen/WxNEoe](https://codepen.io/Rabrennie/pen/WxNEoe) + +![](screenshot.png) + +## Creator +[@pidajo](https://github.com/pidajo) From 44d7e883a40dbb406eebf4210b9f571d694f58dc Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 19:19:20 +0200 Subject: [PATCH 12/50] Add files via upload --- apps/pongclock/pongclock.png | Bin 933 -> 934 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/apps/pongclock/pongclock.png b/apps/pongclock/pongclock.png index 9aa0177b2e90c16bc9310fb05658e801b0202b1a..78934d7c606d485816e991c4286263ff67ca19a8 100644 GIT binary patch delta 562 zcmV-20?qxU2c`#*Ne_U4fdBvh3=9k%9UUtxE3sHR0e^1SbA|u_010qNS#tmY4#NNd z4#NS*Z>VGd00H7jL_t(YOWl-LTN6PPKyMC`SOT`#3y3{puc#=f7%O7$9cu#r|IxX3 z?kowcVe{appXVXB%%0u3v-?HzDN*vQApeBW*JoixzlBmM3gt@0qR7fsoIJ%43A8!T?D!KTfY8e0fdW$QNB4m-RXfSnq4={oGTo-)L+3VUEg_OdVA(tbFg z@gRo|SLz(m+!#F??o|!_Vl@e*!n3>i=5%C6^;ru&WW6d3rQH`qAgz1J6)z` zg=0f2<6KF{dKD&OQ>jz;%*cdEeS8$I`Hqb1aDT&7BMBogm4ut&P#fH`zTD={-Izs^ zFvz{|Yr=g!)Fe!2rsKi`mVGd00H4iL_t(YOWl-bR}(=LK;K1@SSXg*3y3{puc#=X7%O7$9cu#r|D*HX zya}vHVD}t7$K(BwS9b60yxBdG&H$d}T!z%2B5!uK7)|L*y zL5+tve56w2sOHA#v9MNO=pPq30VmVYr+oI)oDn(8IV&6$s+rxSj`bQ$#HLcC=9$qFCiU@AnDQMN*MH%Lr$!P+U^)pm!=cu>WqrBLox3rM zBw>JiRt4d{9%>S1TBhT|1DLfc2orj!>AoQz&RCL&!lTDLiB%Au>W>T4@J!<(QFsph zTG@+xp@-^1jh7k%aXc4Z!KhVAFN{@R*O`1{FDE@9BfN!oRw+S3^vM%dFLo-dtGdOqVVFCN!G!o^@L)+g=Feg6DaJMyQ|>i#$Tpgk~)A2=gZR6nTWg zGZa6ir4$zOy||SrEOcj?&$}~!f3tr~5El6bBUvs7bl1r300000NkvXXu0mjf_yYvZ From 6e0cc5cd9f90b4a8a67a1f66f3f106fc7f46b96e Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 19:40:28 +0200 Subject: [PATCH 13/50] Update settings.js --- apps/pongclock/settings.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/pongclock/settings.js b/apps/pongclock/settings.js index 2c9b9d6a0..0d61d013d 100644 --- a/apps/pongclock/settings.js +++ b/apps/pongclock/settings.js @@ -28,17 +28,17 @@ value: !!settings.isInvers, // !! converts undefined to false format: v => v?"Yes":"No", onchange: v => { - settings.withWidgets = v; + settings.isInvers = v; writeSettings(); } }, 'On Lock?': { - value: !!settings.isInvers, // !! converts undefined to false + value: !!settings.playLocked, // !! converts undefined to false format: v => v?"Play":"Pause", onchange: v => { - settings.withWidgets = v; + settings.playLocked = v; writeSettings(); } } }); -})/*(load)/**/ \ No newline at end of file +})/*(load)/**/ From 787a6ae87e3a6d17fcd3e9dd29d46a62e523afcb Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 19:41:08 +0200 Subject: [PATCH 14/50] Add files via upload --- apps/pongclock/screenshot.png | Bin 0 -> 755 bytes apps/pongclock/screenshot_invers_full.png | Bin 0 -> 480 bytes apps/pongclock/screenshot_settings.png | Bin 0 -> 1154 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/pongclock/screenshot.png create mode 100644 apps/pongclock/screenshot_invers_full.png create mode 100644 apps/pongclock/screenshot_settings.png diff --git a/apps/pongclock/screenshot.png b/apps/pongclock/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..0750105f0bf3e25ac22eec3334235702c2cecd94 GIT binary patch literal 755 zcmVPx#1ZP1_K>z@;j|==^1poj54^T{0MF0Q*|Ns90|Nj9000030(Qvkb00009a7bBm z000id000id0mpBsWB>pHZAnByRA}Dq+igz9APfNDb|-)vyx{~UUcevT|4hCc8-r5D z$BJ>WjnRPkNLcxpoA9r~X5s6X*DToiuXt3OUbs-P>|Lh6@IDOgF8sO22Z2eKK?HUI zHoFWc0xz#H6kdK`L=hO=dGS^mn2XU3Z_MIcD83U7CC1nr?iGsf@=zYvVT;z-2}7}} zrn}1p*u^t%RR!SnQq4zN|^JZ;L z|2d4p3M;JeLt(N(kyEpQblc!tae*mJ&*MDYaB9c&43M4lSvYIOM0&W$@1{7o<(`W) z$i|X|^Hy2lEO`AUo-q2h@%7wc+8fBOdIp;mHb?a(Oj|Lqfe1bXJShfdS}`ziFf_qe zv5%EJY-Yj0!^{{*$wi7Sa5*dDw5?}x2E&=5z`^NCQIoM_<{8L~O>lJ)g1p!SSC>tB z7|z9k6r14UP{he%8`cU67cXA;wa~U!Ffiol2I;qLK0j-4VS?O;EkC8@U{KgzZ%yOr zR>%rcjr|j(u>F(j#_hkbzCZ*wFUZND{tnD9LbSSgC@jPLvYAyEI(!8K{RzWX^X?@~ zH+I8Uvo7@fRjljgMqz~&R#;($6;}Aq!#$y}!U`*_u)+${XncsFu)+!}tgyl&aKo+P z5L|ouGYoUjCKP@MJS{7x<#9_q68=u(3#4KitPw|eUMuY;&&1{8c=eHgR(lJ6f2^

8)3B4w}@M>Aza1>z}stz6JVSKZ~tR51K!ej0*w1xDAF(i_mmfd_A5L06)cZkHOI4NO=GN002ovPDHLkV1it>S||Vj literal 0 HcmV?d00001 diff --git a/apps/pongclock/screenshot_invers_full.png b/apps/pongclock/screenshot_invers_full.png new file mode 100644 index 0000000000000000000000000000000000000000..434e248722a5b200c2490be1a55e3e3bdab3d748 GIT binary patch literal 480 zcmeAS@N?(olHy`uVBq!ia0vp^8$g(a8A!&?{Fw`+7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`1M1^9%x{{R0U$P7JnxeiEi7I;J!GcfQS24TkI`72U@MkIT>IEG~0dwVmm zs6~ON;bB4ZlYi6SmRM;_*uf<|x9s=xvpGN9L32pzn1IG6pg7XNAA4fj}2i`W$Q zK7Y^|Xvmt+TrPjyh*O+@`p%i=2Yl7z4~B~=vS0T*RWr;<$dJ=IQY*zucn-V4GjKq{CE@1_rbVe?a8+7`7$>@eB=M4-{9J? w{6TAAA#a?-aq)*z5RKW4JTUO*;)WCAD@sBxT=}?y7Z?W&p00i_>zopr03ff+=l}o! literal 0 HcmV?d00001 diff --git a/apps/pongclock/screenshot_settings.png b/apps/pongclock/screenshot_settings.png new file mode 100644 index 0000000000000000000000000000000000000000..0b27286ea2122211673304570156c799cf9623a8 GIT binary patch literal 1154 zcmV-|1bzF7P)Px#1ZP1_K>z@;j|==^1poj56;Mo6MF0Q*{{R60|Nj90{{a60sQ>@~0RK~Nwu=A& z010qNS#tmY4#NNd4#NS*Z>VGd00Z_(L_t(&-tC%8lH4E+hG}zw_9A;1CvcT6kVOuX zRqlU;F-QpUvhjnSOcj5nCpI=;%aX8B8|CzRs~&pIo8Fzc^98cWgzb98|7X&3V2}o1 zFxgZZG@3lmS52;h72E~?A^lFk)@0`iq`w~lg8;v;Wn3AoS9Hb8`QTFYDy{$w-ir-> z0PGS@gO44y&hxKlzzWu`;BKyXGoxX9nXx!>6@_r^S+{ z#eD~EO0Z})?FQrZw}Hv#V;=js9eix?MR2o+pSQRTY|i`m3b-jNVjpvsQm!saWbnB> zPQZR#;UF{=sW2ihjJ%R=b^aEx=|d$K4-E|s{Y2TR@;0r-88gpslfA8gTeFT^QK#3N zU{G{IbZ{%bZi4Mb%CH@v0j#co8(d+F;LVYnC&BqnZoygyyDseR=$zmRP~J-T8B zl`Mwf?lKsUu?*0i@p2cA_Vp( zx&6R2%~b42u%5?O?F+dwnCiFUY!ejMcHWUR^9FAcS2>w=G&wHSd8K-Zz8a!JPE}^f z)w0@8pT+l5T4msZJ5PdD5nM_vE+^_>=U}Yx1eo{tz%Fi;;CV1dO|mL(kQVb!0j#MQ z{XBTj$9v$=KY-wRA zQsL2$;76k0;&;JuZ4}J|>x!qSMQ}3T+pQWu1!lJ)SVwQ^pa|CCt%9rwQ*d0!`Qpx3 zaVqmMU5TuHAS=G5O%Qte1KcFRWPm8L@`?8zSoyax(w2~Jx4@afekat|m%wOS0W89b zFKi(hH%%5t5|vaiGp|hBeEc-nXGOskhhU$s0-Wb@&BviEguD=pUV}q;ksd}~Ju4K) zZ5?l^KB|AQ{{H{qAt_qsIGtTaiBBeRo5XEyp#_waG3HUQ1zNILy5Gq4%K_pK-*G0p zme#IfU(~Z;wAOieI-FE|8`Ihq&K_?8XW1w7pVtJEC=JmK2v z=fN(G&j%0W^ir>B3mM!2jNB`(I1r7B=fTD=oj*D98o+q>IeioQcJTBtw~v(i0yqOa Uz*OMF<^TWy07*qoM6N<$g8VEe9RL6T literal 0 HcmV?d00001 From 0443a56a9d7dfb5fc539aa69735141b3a05e0c18 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 19:42:42 +0200 Subject: [PATCH 15/50] Update metadata.json --- apps/pongclock/metadata.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json index 9ce9fe291..31df2e747 100644 --- a/apps/pongclock/metadata.json +++ b/apps/pongclock/metadata.json @@ -7,6 +7,7 @@ "tags": "", "supports": ["BANGLEJS", "BANGLEJS2"], "readme":"README.md", + "screenshots" : [ { "url":"screenshot.png" }, { "url":"screenshot_settings.png" }, { "url":"screenshot_invers_full.png" } ], "storage": [ {"name":"pongclock.app.js","url":"app.js"}, {"name":"pongclock.img","url":"pongclock-icon.js","evaluate":true}, From d2a6789a1f07f21a329980b32251e4edde1107f0 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 19:44:25 +0200 Subject: [PATCH 16/50] Update README.md --- apps/pongclock/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/pongclock/README.md b/apps/pongclock/README.md index cc152d7b9..894070b73 100644 --- a/apps/pongclock/README.md +++ b/apps/pongclock/README.md @@ -8,6 +8,8 @@ A clock which is playing Pong while showing the current time as score * Loosely based on [https://codepen.io/Rabrennie/pen/WxNEoe](https://codepen.io/Rabrennie/pen/WxNEoe) ![](screenshot.png) +![](screenshot_settings.png) +![](screenshot_invers_full.png) ## Creator [@pidajo](https://github.com/pidajo) From 44bb646946cbe344a259de95c0d425d19bd0c76d Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 19:56:55 +0200 Subject: [PATCH 17/50] Update app.js --- apps/pongclock/app.js | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/apps/pongclock/app.js b/apps/pongclock/app.js index 8efe0eca5..e6f8355ea 100644 --- a/apps/pongclock/app.js +++ b/apps/pongclock/app.js @@ -28,7 +28,7 @@ class Ball { } if (test) { this.velX = -this.velX; - this.valY = (3.5 + Math.random()) * this.valY / Math.abs(this.valY); + this.valY = (3.5 + 2 * Math.random()) * this.valY / Math.abs(this.valY); if (isLeft) { right.follow = this; @@ -161,9 +161,17 @@ function redraw() { g.clearRect(0, top + left.oldY, left.w, top + left.oldY + left.h); g.clearRect(width - right.w, top + right.oldY, width, top + right.oldY + right.h); - g.clearRect(width / 2 - fontHeight * 1.4, fontTop, width / 2 + fontHeight * 1.4, fontTop + fontHeight); + //g.clearRect(width / 2 - fontHeight * 1.4, fontTop, width / 2 + fontHeight * 1.4, fontTop + fontHeight); g.clearRect(ball.oldX - ball.w, top + ball.oldY - ball.h, ball.oldX + ball.w, top + ball.oldY + ball.h); + g.setFontVector(fontHeight); + /**/ + g.setFontAlign(1, -1); + g.drawString(("0" + left.score).substr(-2), 5 * width / 11, fontTop, true); + g.setFontAlign(-1, -1); + g.drawString(("0" + right.score).substr(-2), 6 * width / 11, fontTop, true); + /**/ + g.drawLine(width / 2, top, width / 2, topHeight); g.fillRect(0, top + left.y, left.w, top + left.y + left.h); left.oldY = left.y; @@ -172,18 +180,6 @@ function redraw() { g.fillCircle(ball.x, top + ball.y, ball.w); ball.oldX = ball.x; ball.oldY = ball.y; - - g.setFontVector(fontHeight); - /* - g.setFontAlign(0, -1); - g.drawString(("0" + left.score).substr(-2)+ " " + ("0" + right.score).substr(-2), width / 2, fontTop); - */ - /**/ - g.setFontAlign(1, -1); - g.drawString(("0" + left.score).substr(-2), 5 * width / 11, fontTop); - g.setFontAlign(-1, -1); - g.drawString(("0" + right.score).substr(-2), 6 * width / 11, fontTop); - /**/ } function restart() { @@ -224,6 +220,7 @@ function pause() { pauseTimeout = setTimeout(pause, Date.now() % 60000); } +//load settings const SETTINGS_FILE = "pongclock.json"; var settings = Object.assign({ // default values @@ -233,12 +230,14 @@ var settings = Object.assign({ }, require('Storage').readJSON(SETTINGS_FILE, true) || {}); require('Storage').writeJSON(SETTINGS_FILE, settings); +//make clock +Bangle.setUI("clock"); + +//setup play area var height = g.getHeight(), width = g.getWidth(); var top = 0; -Bangle.setUI("clock"); - g.reset(); g.clearRect(0, top, width, height); @@ -252,10 +251,10 @@ if (settings.withWidgets) { var w = WIDGETS[i]; if (w.area) { if (w.area.indexOf("t") >= 0) { - top = 25; + top = Bangle.appRect.y; } if (w.area.indexOf("b") >= 0) { - bottom = 25; + bottom = height - Bangle.appRect.y2; } } } @@ -269,6 +268,7 @@ if (settings.isInvers) { } g.clearRect(0, top, width, top + height); +//setup game var left = new Paddle("left"); var right = new Paddle("right"); var ball = new Ball(true); @@ -291,6 +291,7 @@ Bangle.on("lock", (on) => { } }); +//start clock restart(); if (!settings.playLocked && Bangle.isLocked()) { pause(); @@ -299,6 +300,7 @@ if (!settings.playLocked && Bangle.isLocked()) { } /* +//local testing require("Storage").write("pongclock.info",{ "id":"pongclock", "name":"Pong Clock", From eec644be42fc87b91504b3e11bd844e47863c18b Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 19:58:15 +0200 Subject: [PATCH 18/50] Update metadata.json --- apps/pongclock/metadata.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json index 31df2e747..78565e794 100644 --- a/apps/pongclock/metadata.json +++ b/apps/pongclock/metadata.json @@ -5,6 +5,7 @@ "version":"0.1", "description": "A clock playing Pong", "tags": "", + "allow_emulator":true, "supports": ["BANGLEJS", "BANGLEJS2"], "readme":"README.md", "screenshots" : [ { "url":"screenshot.png" }, { "url":"screenshot_settings.png" }, { "url":"screenshot_invers_full.png" } ], From 1f59957735f7da4a9c3e557ca4315194e827c62e Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 20:03:56 +0200 Subject: [PATCH 19/50] Update pongclock-icon.js --- apps/pongclock/pongclock-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pongclock/pongclock-icon.js b/apps/pongclock/pongclock-icon.js index 00002a018..22e472af4 100644 --- a/apps/pongclock/pongclock-icon.js +++ b/apps/pongclock/pongclock-icon.js @@ -1 +1 @@ -atob("MDCEBP//////////////AA//////////////////////////////AA//////////////////////////////AA//////////////////////////////AA//////////////////////////P///Ii//////////P////////zEAP/MQAC///////xAf//8xAAL/////8gAAP/AAAAL//////wAv//MAAAAv////8gEAPzAD8QD/Ii//8wA///IAPxAf////8S8APyAf8wD/AA//8gD///EB/yAP//////8APxAP8wD/AA//8AH///AB/yAf//////8AP///8gD/AA//MAP//////xAf//////8AP///8QH/AA//IA///////wAv//////8AP///MAP/AA//EB8AL///8gD///////8AP///EB//AA//AC8AL///8AL///////8AP//yAD//AA/zAD8AL///IA////////8AP//wAf//AA/xAP8AL//zAC////////8AP/8gA///Ii/wAf8AL//xAP///wAP//8AP/MAH/////8wABEAEf8wAv///wAP//8AP/EA//////8wAAAAAf8QD////wAP//8APzAB////Ii/yIiIAEvIAL////wAP//8APyAAAAD/AA////8AL/EAAAAP/wAP//8APyAAAAD/AA////8AL/EAAAAP/wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////AA///////////////wAP////////////Ii///////////////wAP///////////////////////////wAAAP///////////////////////////wAP//////////////Ii/////////////wAP//////8yP/////AA/////////////wAP//////EAAf////AA/////////////wAP/////zAAAD////AA/////////////wAP/////yAAAC////AA/////////////wAP/////zAAAD////AA/////////////wAP//////EAAf////AA/////////////wAP//////8yP/////AA/////////////wAP//////////////AA/////////////wAP//////////////Ii/////////////wAP/////////////////////////////wAP//////////////////////////////////////////////Ii//////////////////////////////AA//////////////////////////////AA//////////////////////////////AA//////////////////////////////AA///////////////w==") +atob("MDCEBAAAAAAAAAAAAAAALyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALyAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAIiAAAAAAAAAAEAAAAAAAABP/EAE//yAAAAAAAD8wAAAT//IAAAAAAv//EA////IAAAAAAP8gAAH///8gAAAAAvP/EB/xA/MAIiAAAf8QAAL/ED8wAAAAAxD/EC8wAf8ALyAAAv8AAAPyAC/wAAAAAAD/ED/wAf8ALyAAD/MAAA/zAC8wAAAAAAD/EAAAAv8ALyAAH/EAAAAAAD8wAAAAAAD/EAAAA/IALyAAL/AAAAAAAP8gAAAAAAD/EAAAH/EALyAAPzD/IAAAAv8AAAAAAAD/EAAAPzAALyAA/yD/IAAAD/IAAAAAAAD/EAAB/xAALyAB/xD/IAAAL/AAAAAAAAD/EAAP8wAALyAC/wD/IAAB/yAAAAAAAAD/EAAv8QAAIiAP8wD/IAAD/wAAAAAAAAD/EAD/MAAAAAAf/zP/MwAf8gAAAA//AAD/EAL/AAAAAAAf////8wA/8AAAAA//AAD/EB/zAAAAIiACIiL/MgL/IAAAAA//AAD/EC////8ALyAAAAD/IAP////wAA//AAD/EC////8ALyAAAAD/IAP////wAA//AAAAAAAAAAAALyAAAAAAAAAAAAAAAA//AAAAAAAAAAAALyAAAAAAAAAAAAAAAA//AAAAAAAAAAAALyAAAAAAAAAAAAAAAA//AAAAAAAAAAAALyAAAAAAAAAAAAAAAA//AAAAAAAAAAAALyAAAAAAAAAAAAAAAA//AAAAAAAAAAAALyAAAAAAAAAAAAAAAA//AAAAAAAAAAAAIiAAAAAAAAAAAAAAAA//AAAAAAAAAAAAAAAAAAAAAAAAAAD/8A//AAAAAAAAAAAAAAAAAAAAAAAAAAD/8AAAAAAAAAAAAAAAIiAAAAAAAAAAAAD/8AAAAAAAASEAAAAALyAAAAAAAAAAAAD/8AAAAAAAP/8wAAAALyAAAAAAAAAAAAD/8AAAAAAB///xAAAALyAAAAAAAAAAAAD/8AAAAAAC///yAAAALyAAAAAAAAAAAAD/8AAAAAAB///xAAAALyAAAAAAAAAAAAD/8AAAAAAAP/8wAAAALyAAAAAAAAAAAAD/8AAAAAAAASEAAAAALyAAAAAAAAAAAAD/8AAAAAAAAAAAAAAALyAAAAAAAAAAAAD/8AAAAAAAAAAAAAAAIiAAAAAAAAAAAAD/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALyAAAAAAAAAAAAAAAA==") From 11c7fd7e341b8036822c4ebab7eff8e16979edce Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 20:15:01 +0200 Subject: [PATCH 20/50] Update metadata.json --- apps/pongclock/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json index 78565e794..f4c23c7c1 100644 --- a/apps/pongclock/metadata.json +++ b/apps/pongclock/metadata.json @@ -3,7 +3,7 @@ "shortName":"Pong Clock", "icon": "pongclock.png", "version":"0.1", - "description": "A clock playing Pong", + "description": "A Pong playing clock", "tags": "", "allow_emulator":true, "supports": ["BANGLEJS", "BANGLEJS2"], From fd3838dff6731ac00f79db72764ac45654702d82 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 23:53:15 +0200 Subject: [PATCH 21/50] Update app.js --- apps/pongclock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pongclock/app.js b/apps/pongclock/app.js index e6f8355ea..932c1f3d7 100644 --- a/apps/pongclock/app.js +++ b/apps/pongclock/app.js @@ -28,7 +28,7 @@ class Ball { } if (test) { this.velX = -this.velX; - this.valY = (3.5 + 2 * Math.random()) * this.valY / Math.abs(this.valY); + this.velY = (3.5 + 2 * Math.random()) * this.velY / Math.abs(this.velY); if (isLeft) { right.follow = this; From 5b85363de8d6383120ba98f71adf2c9162e426fc Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 23:53:54 +0200 Subject: [PATCH 22/50] Update metadata.json --- apps/pongclock/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pongclock/metadata.json b/apps/pongclock/metadata.json index f4c23c7c1..dbd044517 100644 --- a/apps/pongclock/metadata.json +++ b/apps/pongclock/metadata.json @@ -2,7 +2,7 @@ "name": "Pong Clock", "shortName":"Pong Clock", "icon": "pongclock.png", - "version":"0.1", + "version":"0.01", "description": "A Pong playing clock", "tags": "", "allow_emulator":true, From 133abbee90c1d8d7336ea872f4c327e31494728d Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 20 May 2022 23:54:15 +0200 Subject: [PATCH 23/50] Update ChangeLog --- apps/pongclock/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pongclock/ChangeLog b/apps/pongclock/ChangeLog index e8c8518ae..7b83706bf 100644 --- a/apps/pongclock/ChangeLog +++ b/apps/pongclock/ChangeLog @@ -1 +1 @@ -0.1: First release +0.01: First release 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 24/50] 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 + }; +})() From e672b523c558e7ff7b01c92f2b232df9810e50c2 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:33:19 +0200 Subject: [PATCH 25/50] Update app.js --- apps/widday/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/widday/app.js b/apps/widday/app.js index a244098f5..189fc1951 100644 --- a/apps/widday/app.js +++ b/apps/widday/app.js @@ -15,11 +15,11 @@ } setInterval(function() { - WIDGETS["widdateday"].draw(WIDGETS["widdateday"]); + WIDGETS["widday"].draw(WIDGETS["widdateday"]); }, 10*60000); // update every 10 minutes // add your widget - WIDGETS["widdateday"]={ + WIDGETS["widday"]={ 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 From c5fac3dd2a6da475f22af869727f4fd60bd97a11 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:37:26 +0200 Subject: [PATCH 26/50] Create widday.info --- apps/widday/widday.info | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 apps/widday/widday.info diff --git a/apps/widday/widday.info b/apps/widday/widday.info new file mode 100644 index 000000000..351a302ca --- /dev/null +++ b/apps/widday/widday.info @@ -0,0 +1,8 @@ +{ + "id":"widday", + "name":"Day Widget", + "type":"widget", + "version":"0.01", + "tags":"widget,date,day", + "files":"widday.info,widday.wid.js" +} From 858d4deeebefb62246322619c647fdef91c99097 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:45:07 +0200 Subject: [PATCH 27/50] Create app-icon.js --- apps/widday/app-icon.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/widday/app-icon.js diff --git a/apps/widday/app-icon.js b/apps/widday/app-icon.js new file mode 100644 index 000000000..aa17aedc5 --- /dev/null +++ b/apps/widday/app-icon.js @@ -0,0 +1 @@ +atob("MDCEAiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIBEREREREREREREREREREREREREREQIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////zMz////8zMzMzMzP////xIiIf///////czM////PMzMzMzMzP///xIiIf/////zzMzM////PMzMzMzMzP///xIiIf////PczMzM////PMzMzMzMzP///xIiIf////3MzMzM////8zMzMz3MzP///xIiIf////3MM8zM//////////zMw////xIiIf////0/88zM/////////zzMz////xIiIf//////88zM/////////8zM3////xIiIf//////88zM////////88zM/////xIiIf//////88zM/////////MzN/////xIiIf//////88zM////////PMzD/////xIiIf//////88zM////////3Mzf/////xIiIf//////88zM////////zMw//////xIiIf//////88zM///////9zMz//////xIiIf//////88zM///////8zMP//////xIiIf//////88zM//////88zM///////xIiIf//////88zM///////MzN///////xIiIf////8zM8zM//////PMzD///////xIiIf////3MzMzMzM3///3Mzf///////xIiIf////3MzMzMzM3//zzMw////////xIiIf////PMzMzMzM3//9zMz////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIf///////////////////////////xIiIBEREREREREREREREREREREREREREQIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIg==") From 68af6449dc5e737cf3503a073af1752f166d2580 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:45:59 +0200 Subject: [PATCH 28/50] Create ChangeLog --- apps/widday/ChangeLog | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/widday/ChangeLog diff --git a/apps/widday/ChangeLog b/apps/widday/ChangeLog new file mode 100644 index 000000000..7b83706bf --- /dev/null +++ b/apps/widday/ChangeLog @@ -0,0 +1 @@ +0.01: First release From 6ab7263272e310c891a84e1ffd02d78760cf4384 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:48:07 +0200 Subject: [PATCH 29/50] Create metadata.info --- apps/widday/metadata.info | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 apps/widday/metadata.info diff --git a/apps/widday/metadata.info b/apps/widday/metadata.info new file mode 100644 index 000000000..1569528b0 --- /dev/null +++ b/apps/widday/metadata.info @@ -0,0 +1,12 @@ +{ "id": "widday", + "name": "Day Widget", + "shortName":"My Timer", + "icon": "widday.png", + "version":"0.01", + "description": "Just the day of the current date as widget", + "tags": "widget,say,date", + "storage": [ + {"name":"widday.wid.js","url":"app.js"}, + {"name":"widday.img","url":"app-icon.js","evaluate":true} + ] +} From 515469d2b5de6639efe30a9a7d96951a13e188e4 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:51:02 +0200 Subject: [PATCH 30/50] Update metadata.info --- apps/widday/metadata.info | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/widday/metadata.info b/apps/widday/metadata.info index 1569528b0..fe999110a 100644 --- a/apps/widday/metadata.info +++ b/apps/widday/metadata.info @@ -4,6 +4,7 @@ "icon": "widday.png", "version":"0.01", "description": "Just the day of the current date as widget", + readme: "README.md "tags": "widget,say,date", "storage": [ {"name":"widday.wid.js","url":"app.js"}, From 309db1bdf2f641eff395dfc8bac51109a9e639f6 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:54:55 +0200 Subject: [PATCH 31/50] Create README.md --- apps/widday/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 apps/widday/README.md diff --git a/apps/widday/README.md b/apps/widday/README.md new file mode 100644 index 000000000..9d1969471 --- /dev/null +++ b/apps/widday/README.md @@ -0,0 +1,3 @@ +==Day Widget + +Just shows the day of the current date, to save space in the widget area. The month and year should be known because they don't change that often. Just the number in maximum size for readability. From 61135af33f7a761f83fe8ef4626918d09d3c819c Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:56:44 +0200 Subject: [PATCH 32/50] Update README.md --- apps/widday/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/widday/README.md b/apps/widday/README.md index 9d1969471..61f48aa4c 100644 --- a/apps/widday/README.md +++ b/apps/widday/README.md @@ -1,3 +1,9 @@ -==Day Widget +# Day Widget Just shows the day of the current date, to save space in the widget area. The month and year should be known because they don't change that often. Just the number in maximum size for readability. + +![](screenshot.png) + +## Creator +[@pidajo](https://github.com/pidajo) + From 65524a28b67ca76207417d9afaa422ab0a6bce30 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Thu, 26 May 2022 18:58:40 +0200 Subject: [PATCH 33/50] Update metadata.info --- apps/widday/metadata.info | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/widday/metadata.info b/apps/widday/metadata.info index fe999110a..54e42f000 100644 --- a/apps/widday/metadata.info +++ b/apps/widday/metadata.info @@ -6,6 +6,9 @@ "description": "Just the day of the current date as widget", readme: "README.md "tags": "widget,say,date", + "allow_emulator":true, + "supports": ["BANGLEJS", "BANGLEJS2"], + "screenshots" : [ { "url":"screenshot.png" } ], "storage": [ {"name":"widday.wid.js","url":"app.js"}, {"name":"widday.img","url":"app-icon.js","evaluate":true} From 704195c8b7aeda0bc6b45fa90135c5365902367a Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Fri, 27 May 2022 00:10:45 +0200 Subject: [PATCH 34/50] Add files via upload --- apps/widday/screenshot.png | Bin 0 -> 938 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/widday/screenshot.png diff --git a/apps/widday/screenshot.png b/apps/widday/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..9a7a9f8cf2734434d401dfb8ad00aae994e1f7af GIT binary patch literal 938 zcmV;b16BNqP)Px#1ZP1_K>z@;j|==^1poj56;Mo6MF0Q*Hvj-PH#Yz`Hvl&P03;;;|NnfXPbB~V z010qNS#tmY4#NNd4#NS*Z>VGd00SOLL_t(&-tC!Dj^iKx<)$Qbxf|Vtxc7SUw4|E(1o;o#y>Q?) zHkeJer#}YIg^raD23wP-=zBZBdOd;X%;(GCKVQ3Iu=BF>1k-N_u(5Ur-?ofHSWMm( z7v}>XJp@><9K1^~*z7rLn!y}+qAhm(In$U9>DUU^A=_fGO=S!?b_E9PT@eQl0*-4uNyYCivgTnxchcv`ul?PX)TcN{GLh-a&IY3HaKhsN1^m30Tv4^P=d;AaO z73HzZOSf72xrP%G9|~R~3<4a+a*Wu)3I%pkoa^x$H_T=g^;Lhvwq1^{usgr4su6+$ zY>Q$9o@RGXjn1*R2?WOz@iYs8&80jC7Qk)6Q;|(2uxd?05%2;A2Oo3HmO}7sXI&oe z!E?LG4?`YovpMp#_L2924N6E-;Lh2uM3wRG(9qD3n1~31NjuD1Qm+W`n)xP#$*234 z1#7Y|N65LG+MKRaUod#J4YD4$%_gU(<^-@_L$gU@;M5n^r4VqMaH++u!Fvx@jlt7W z;CI2pgFExMFhKf8Uj8CBv1`hZ1FuqGB?KNC8X6iJ8iI>*MOOnR?KrRVAk}ehIo1fy zEyt7?m}^&8b8_LS_v-UQWy@G~D7?dts+Kyb5$@6*%+T$aD*STxh3P?n^|_GU)(3sy zT!lWJB0t0@r&clLvuCTl$k1KI^2Pfx!wLjV8( M07*qoM6N<$f^(y#>Hq)$ literal 0 HcmV?d00001 From 3dabc77c553a59db5e1ec80973acf61452e2d701 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 12:42:05 +0200 Subject: [PATCH 35/50] Rename metadata.info to metadata.json --- apps/widday/{metadata.info => metadata.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename apps/widday/{metadata.info => metadata.json} (100%) diff --git a/apps/widday/metadata.info b/apps/widday/metadata.json similarity index 100% rename from apps/widday/metadata.info rename to apps/widday/metadata.json From 9defc580c2ac62bfe950e280f705f3ebf5b84a88 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 12:42:41 +0200 Subject: [PATCH 36/50] Update metadata.json --- apps/widday/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index 54e42f000..1a12e6f56 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -4,7 +4,7 @@ "icon": "widday.png", "version":"0.01", "description": "Just the day of the current date as widget", - readme: "README.md + readme: "README.md" "tags": "widget,say,date", "allow_emulator":true, "supports": ["BANGLEJS", "BANGLEJS2"], From 9c8463d2dc7b0f4ba0b1cd8a69ca6ae434046ff7 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 12:43:07 +0200 Subject: [PATCH 37/50] Delete widday.info --- apps/widday/widday.info | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 apps/widday/widday.info diff --git a/apps/widday/widday.info b/apps/widday/widday.info deleted file mode 100644 index 351a302ca..000000000 --- a/apps/widday/widday.info +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id":"widday", - "name":"Day Widget", - "type":"widget", - "version":"0.01", - "tags":"widget,date,day", - "files":"widday.info,widday.wid.js" -} From d88c2d6ede22508ad65b349fa95eda8d27de58b0 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 12:44:08 +0200 Subject: [PATCH 38/50] Delete pongclock.img --- apps/pongclock/pongclock.img | Bin 1156 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 apps/pongclock/pongclock.img diff --git a/apps/pongclock/pongclock.img b/apps/pongclock/pongclock.img deleted file mode 100644 index e0045eff79314697cb8fe35138277dd0de433bc6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1156 zcmcJNQEtN^5JVR{|3>NoAie;oIRKaIft~mO+nI&fSg!w4BrD5fn4JJQ|J-CBy6kmd zeS~|FIW||+9AD~P(P(waoWEEPs(#X13znU#iH22uc#bQ5oO1`BaYG;BSLy%hW>&UNWPw3kNy2f@>t7EWdFER5bVG z&5e2n(S^Y8Rl8P2eYsG z1ffabKcYrr^Z%Q}gM*T7bd#<;i2j>z?}wod&9; Date: Mon, 6 Jun 2022 13:33:55 +0200 Subject: [PATCH 39/50] Update metadata.json --- apps/widday/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index 1a12e6f56..e929c9498 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -4,7 +4,7 @@ "icon": "widday.png", "version":"0.01", "description": "Just the day of the current date as widget", - readme: "README.md" + "readme": "README.md" "tags": "widget,say,date", "allow_emulator":true, "supports": ["BANGLEJS", "BANGLEJS2"], From 2529f294e27abf160d2b7c2e55b14328e71c6aec Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 13:40:07 +0200 Subject: [PATCH 40/50] Update metadata.json --- apps/widday/metadata.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index e929c9498..530cd9276 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -10,7 +10,6 @@ "supports": ["BANGLEJS", "BANGLEJS2"], "screenshots" : [ { "url":"screenshot.png" } ], "storage": [ - {"name":"widday.wid.js","url":"app.js"}, - {"name":"widday.img","url":"app-icon.js","evaluate":true} + {"name":"widday.wid.js","url":"app.js"} ] } From 0499e6040c824375f156b592777842d8d76327ec Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 13:43:08 +0200 Subject: [PATCH 41/50] Update metadata.json --- apps/widday/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index 530cd9276..86647b729 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -4,7 +4,7 @@ "icon": "widday.png", "version":"0.01", "description": "Just the day of the current date as widget", - "readme": "README.md" + "readme": "README.md", "tags": "widget,say,date", "allow_emulator":true, "supports": ["BANGLEJS", "BANGLEJS2"], From fb0af46f49a5c99abfe987d764673936c1a9807c Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 13:46:30 +0200 Subject: [PATCH 42/50] Add files via upload --- apps/widday/widget.png | Bin 0 -> 778 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/widday/widget.png diff --git a/apps/widday/widget.png b/apps/widday/widget.png new file mode 100644 index 0000000000000000000000000000000000000000..4620978719b3091d1e043eacc05df818219249d3 GIT binary patch literal 778 zcmV+l1NHogP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0-s4lK~!i%?U_GF z>rfQNzvmxZ6w%FsI`|J~!9hByI156%h=ZuJi?f30pe_n7f{P&9BDm@3QbiEK!BHtv zD7YxUK4drw(&d(_nX>JC(yP4RD$KyyQlNG!N(rGEihFOdY(bdJqB5Z8f z`>IAJ!wcA{>^-o)4)pfIoC2O8pPv*(xWA|H$lDu*JL(25FM+{9V0IRGedS3Dr3|<% zg|gJvQn;gTU}Xh3IbmW_S4Tlg8JL&=4iAgR!2z(l3k(mlGih%J+S-^XQ1%%Z9nG!F zh6cmf-ZqTQP5XLnZDmKFSg$1^*LT6+Gtk)yEGz&|Pr&3PPg*E-2g(Jx#8Eq{yy;h%!DY;zVLGfK0YWsvb01& z#>PBVExmW(^c1+hWe?V2Ll84e*OJyP{-e9 z?)H{Kk((O|3$h(QJ7YpBoPBiz@-55@Jv|f__Vy@9Qxh;X#iT;YE+OIlT|L}*c`1ZX z{4F7&rba#7sIM=?58%zfFC;Xeo6vx60&gJy6GPzt Date: Mon, 6 Jun 2022 13:49:31 +0200 Subject: [PATCH 43/50] Update metadata.json --- apps/widday/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index 86647b729..6065c6881 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -1,7 +1,7 @@ { "id": "widday", "name": "Day Widget", "shortName":"My Timer", - "icon": "widday.png", + "icon": "widget.png", "version":"0.01", "description": "Just the day of the current date as widget", "readme": "README.md", From b2d1a52800a4509c854b013de98e63c5085fcf98 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 13:52:26 +0200 Subject: [PATCH 44/50] Update app.js --- apps/widday/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widday/app.js b/apps/widday/app.js index 189fc1951..cdea76a29 100644 --- a/apps/widday/app.js +++ b/apps/widday/app.js @@ -7,7 +7,7 @@ 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(); + var text = date.getDate(); g.setFont("Vector", 24); g.drawString(text, this.x+width/2+1, this.y + 28); //g.setColor(0, 0, 1); From de751b1b80bd4897e87e356996101d322d01aa35 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 14:00:17 +0200 Subject: [PATCH 45/50] Rename app.js to widget.js --- apps/widday/{app.js => widget.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename apps/widday/{app.js => widget.js} (100%) diff --git a/apps/widday/app.js b/apps/widday/widget.js similarity index 100% rename from apps/widday/app.js rename to apps/widday/widget.js From e75a044257ce8ff30e674dea4c3446ccd971e8a9 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 14:00:40 +0200 Subject: [PATCH 46/50] Update metadata.json --- apps/widday/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index 6065c6881..f75652c09 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -10,6 +10,6 @@ "supports": ["BANGLEJS", "BANGLEJS2"], "screenshots" : [ { "url":"screenshot.png" } ], "storage": [ - {"name":"widday.wid.js","url":"app.js"} + {"name":"widday.wid.js","url":"widget.js"} ] } From de4b820b58e95851d2d00dda550a358adcb1cbf9 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 14:05:50 +0200 Subject: [PATCH 47/50] Update metadata.json --- apps/widday/metadata.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index f75652c09..3fd406b4b 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -2,6 +2,7 @@ "name": "Day Widget", "shortName":"My Timer", "icon": "widget.png", + "type": "widget" "version":"0.01", "description": "Just the day of the current date as widget", "readme": "README.md", From fe5c293c4603b15ba8b06e325955125b5dbeef23 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 14:07:11 +0200 Subject: [PATCH 48/50] Update metadata.json --- apps/widday/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index 3fd406b4b..352fe78c0 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -2,7 +2,7 @@ "name": "Day Widget", "shortName":"My Timer", "icon": "widget.png", - "type": "widget" + "type": "widget", "version":"0.01", "description": "Just the day of the current date as widget", "readme": "README.md", From bb1f8d6c2bdfa7993eeedb4f46aa7943de934fe9 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 14:11:00 +0200 Subject: [PATCH 49/50] Update app.js --- apps/pongclock/app.js | 167 +++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 84 deletions(-) diff --git a/apps/pongclock/app.js b/apps/pongclock/app.js index 932c1f3d7..2a10bf6ed 100644 --- a/apps/pongclock/app.js +++ b/apps/pongclock/app.js @@ -1,119 +1,116 @@ class Ball { - constructor(collision) { - this.collision = collision; - this.w = 4; - this.h = this.w; - this.y = height / 2 - this.h / 2; - this.x = width / 2 - this.w / 2; + constructor(collision) { + this.collision = collision; + this.w = 4; + this.h = this.w; + this.y = height / 2 - this.h / 2; + this.x = width / 2 - this.w / 2; this.oldX = this.x; this.oldY = this.y; - this.velX = 6; - this.velY = 3.5 + Math.random(); - } + this.velX = 6; + this.velY = 3.5 + Math.random(); + } - reset() { - this.y = height / 2 - this.h / 2; - this.x = width / 2 - this.w / 2; - this.velX = 6; - this.velY = 3.5 + Math.random(); - } + reset() { + this.y = height / 2 - this.h / 2; + this.x = width / 2 - this.w / 2; + this.velX = 6; + this.velY = 3.5 + Math.random(); + } - checkCollision(that, isLeft) { + checkCollision(that, isLeft) { let test = false; if (isLeft) { test = this.x <= that.w + this.w && this.y > that.y && this.y < that.y + that.h; - } - else { + } else { test = this.x >= that.x + this.w && this.y > that.y && this.y < that.y + that.h; } - if (test) { - this.velX = -this.velX; + if (test) { + this.velX = -this.velX; this.velY = (3.5 + 2 * Math.random()) * this.velY / Math.abs(this.velY); if (isLeft) { - right.follow = this; + right.follow = this; left.follow = null; - } else { - left.follow = this; + } else { + left.follow = this; right.follow = null; - } - } - } + } + } + } - move() { - if (this.velX > 0) { - this.checkCollision(right, false); - } else { - this.checkCollision(left, true); + move() { + if (this.velX > 0) { + this.checkCollision(right, false); + } else { + this.checkCollision(left, true); } - this.x += this.velX; - this.y += this.velY; + this.x += this.velX; + this.y += this.velY; - if (this.y <= this.h) { - this.y = this.h; + if (this.y <= this.h) { + this.y = this.h; this.velY = -this.velY; - } + } - if (this.y >= height - this.h) { - this.y = height - this.h; + if (this.y >= height - this.h) { + this.y = height - this.h; this.velY = -this.velY; - } + } - if(this.x >= width) { - left.scored(); + if (this.x >= width) { + left.scored(); restart(); - } else if(this.x < 0) { - right.scored(); + } else if (this.x < 0) { + right.scored(); restart(); - } + } - } + } } class Paddle { - constructor(side) { - this.side = side; - this.w = 4;//15; - this.h = 30;//80; - this.y = height / 2 - this.h/2; - this.follow = null; - this.target = height / 2 - this.h/2; - this.score = 99; + constructor(side) { + this.side = side; + this.w = 4; //15; + this.h = 30; //80; + this.y = height / 2 - this.h / 2; + this.follow = null; + this.target = height / 2 - this.h / 2; + this.score = 99; this.hasLost = false; - } + } - reset() { - this.follow = null; + reset() { + this.follow = null; this.hasLost = false; - this.target = height / 2 - this.h/2; - this.y = height / 2 - this.h/2; - this.move(); - } + this.target = height / 2 - this.h / 2; + this.y = height / 2 - this.h / 2; + this.move(); + } - scored() { + scored() { let d = new Date(); let value = 0; if (this.side == "left") { - value = d.getHours(); + value = d.getHours(); } else { - value = d.getMinutes(); + value = d.getMinutes(); } if (this.score < value) { this.score++; - } - else { + } else { this.score = value; } - } + } - move() { + move() { - if (this.follow && ! this.hasLost) { + if (this.follow && !this.hasLost) { var dy = this.follow.y - this.y - this.h / 2; this.y += dy / 2; - } - else { + } else { this.y += (this.target - this.y) / 10; } if (this.y < 0) { @@ -122,25 +119,26 @@ class Paddle { if (this.y > height - this.h) { this.y = height - this.h; } - } + } } var updateTimeout = null; + function update() { - var d = new Date(); + var d = new Date(); var lastStep = Date.now(); - left.move(); - right.move(); - if(d.getHours() != left.score) { + left.move(); + right.move(); + if (d.getHours() != left.score) { right.follow = null; - right.hasLost = true; - } - if(d.getMinutes() != right.score) { + right.hasLost = true; + } + if (d.getMinutes() != right.score) { left.follow = null; - left.hasLost = true; - } - - ball.move(); + left.hasLost = true; + } + + ball.move(); redraw(); var nextStep = 40 - (Date.now() - lastStep); //console.log(nextStep); @@ -153,7 +151,7 @@ function redraw() { let fontTop = top + height / 11; let topHeight = top + height; g.reset(); - + if (settings.isInvers) { g.setColor(g.theme.bg); g.setBgColor(g.theme.fg); @@ -212,6 +210,7 @@ function stop() { } var pauseTimeout = null; + function pause() { stop(); left.scored(); @@ -235,7 +234,7 @@ Bangle.setUI("clock"); //setup play area var height = g.getHeight(), - width = g.getWidth(); + width = g.getWidth(); var top = 0; g.reset(); From 336ee1052a741ee90b0f704926ad7a10d1fd8666 Mon Sep 17 00:00:00 2001 From: pidajo <99899574+pidajo@users.noreply.github.com> Date: Mon, 6 Jun 2022 14:19:00 +0200 Subject: [PATCH 50/50] Update metadata.json --- apps/widday/metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/widday/metadata.json b/apps/widday/metadata.json index 352fe78c0..82de23035 100644 --- a/apps/widday/metadata.json +++ b/apps/widday/metadata.json @@ -7,7 +7,6 @@ "description": "Just the day of the current date as widget", "readme": "README.md", "tags": "widget,say,date", - "allow_emulator":true, "supports": ["BANGLEJS", "BANGLEJS2"], "screenshots" : [ { "url":"screenshot.png" } ], "storage": [