Merge branch 'master' of github.com:nxdefiant/BangleApps

pull/1806/head
Erik Andresen 2022-05-09 11:25:09 +02:00
commit be230aad2b
22 changed files with 1813 additions and 28 deletions

View File

@ -1,2 +1,3 @@
0.01: New App
0.02: app keeps track of statistics now
0.03: Fix bug in valid word detection

View File

@ -110,7 +110,12 @@ class Wordle {
}
}
addGuess(w) {
if ((this.words.indexOf(w.toLowerCase())%5)!=0) {
let idx = -1;
do{
idx = this.words.indexOf(w.toLowerCase(), idx+1);
}
while(idx !== -1 && idx%5 !== 0);
if(idx%5 !== 0) {
E.showAlert(w+"\nis not a word", "Invalid word").then(function() {
layout = getKeyLayout("");
wordle.render(true);

View File

@ -2,7 +2,7 @@
"name": "Bordle",
"shortName":"Bordle",
"icon": "app.png",
"version":"0.02",
"version":"0.03",
"description": "Bangle version of a popular word search game",
"supports" : ["BANGLEJS2"],
"readme": "README.md",

View File

@ -564,7 +564,7 @@ var locales = {
month: "Janeiro,Fevereiro,Março,Abril,Maio,Junho,Julho,Agosto,Setembro,Outubro,Novembro,Dezembro",
abday: "Dom,Seg,Ter,Qua,Qui,Sex,Sab",
day: "Domingo,Segunda-feira,Terça-feira,Quarta-feira,Quinta-feira,Sexta-feira,Sábado",
trans: { yes: "sim", Yes: "Sim", no: "não", No: "Não", ok: "certo", on: "ligado", off: "desligado" }
trans: { yes: "sim", Yes: "Sim", no: "não", No: "Não", ok: "confirmar", on: "ativado", off: "desativado" }
},
"cs_CZ": { // THIS NEVER WORKED PROPERLY - many chars are not in the ISO8859-1 codepage and we use CODEPAGE_CONVERSIONS
lang: "cs_CZ",

View File

@ -1,4 +1,5 @@
0.01: Initial release
0.02: Optional fullscreen mode
0.03: Optional show lock status via color
0.04: Ensure that widgets are always hidden in fullscreen mode
0.04: Ensure that widgets are always hidden in fullscreen mode
0.05: Better lock/unlock animation

View File

@ -24,4 +24,4 @@ Shows the watchface in fullscreen mode.
Note: In fullscreen mode, widgets are hidden, but still loaded.
### Show lock status
If enabled, color changes when unlocked to detect the lock state easily.
If enabled, the lock/unlock event is animated by changing the colors.

View File

@ -2,7 +2,7 @@
"id": "neonx",
"name": "Neon X & IO X Clock",
"shortName": "Neon X Clock",
"version": "0.04",
"version": "0.05",
"description": "Pebble Neon X & Neon IO X for Bangle.js",
"icon": "neonx.png",
"type": "clock",

View File

@ -36,14 +36,8 @@ const digits = {
const colors = {
x: [
["#FF00FF", "#00FFFF"],
["#00FF00", "#FFFF00"]
],
io: [
["#FF00FF", "#FFFF00"],
["#00FF00", "#00FFFF"]
]
x: ["#FF00FF", "#00FF00", "#00FFFF", "#FFFF00"],
io:["#FF00FF", "#00FF00", "#FFFF00", "#00FFFF"],
};
const is12hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]||false;
const screenWidth = g.getWidth();
@ -71,7 +65,7 @@ function drawLine(poly, thickness){
}
function drawClock(num){
function drawClock(num, xc){
let tx, ty;
if(settings.fullscreen){
@ -84,9 +78,8 @@ function drawClock(num){
for (let y = 0; y <= 1; y++) {
const current = ((y + 1) * 2 + x - 1);
let newScale = scale;
let xc = settings.showLock && !Bangle.isLocked() ? Math.abs(x-1) : x;
let c = colors[settings.io ? 'io' : 'x'][y][xc];
let colorArr = colors[settings.io ? 'io' : 'x'];
let c = colorArr[xc];
g.setColor(c);
if (!settings.io) {
@ -104,6 +97,8 @@ function drawClock(num){
for (let i = 0; i < digits[num[y][x]].length; i++) {
drawLine(g.transformVertices(digits[num[y][x]][i], { x: tx, y: ty, scale: newScale}), settings.thickness);
}
xc = (xc+1) % colorArr.length;
}
}
}
@ -111,7 +106,31 @@ function drawClock(num){
function draw(date){
queueDraw();
_draw(date, 0);
}
function drawAnimated(){
queueDraw();
// Animate draw through different colors
speed = 25;
setTimeout(function() {
_draw(false, 1);
setTimeout(function() {
_draw(false, 3);
setTimeout(function() {
_draw(false, 2);
setTimeout(function(){
_draw(false, 0);
}, speed);
}, speed);
}, speed);
}, speed);
}
function _draw(date, xc){
// Depending on the settings, we clear all widgets or draw those.
if(settings.fullscreen){
for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";}
@ -140,7 +159,7 @@ function draw(date){
l2 = ('0' + d.getMinutes()).substr(-2);
}
drawClock([l1, l2]);
drawClock([l1, l2], xc);
}
@ -173,8 +192,14 @@ Bangle.on('lcdPower', function(on){
}
});
Bangle.on('lock', function(isLocked) {
draw();
if(!settings.showLock){
return;
}
// Animate in case the use selected this setting.
drawAnimated();
});

View File

@ -19,7 +19,7 @@
if (!neonXSettings) resetSettings();
let thicknesses = [1, 2, 3, 4, 5, 6];
let thicknesses = [1, 2, 3, 4, 5, 6, 7];
const menu = {
"" : { "title":"Neon X & IO"},

View File

@ -11,7 +11,7 @@ function scrollX(){
gfx.clearRect(0,gfx.getHeight()*(1/4),gfx.getWidth(),0);
gfx.scroll(0,gfx.getHeight()/4);
score++;
if(typeof(m) != undefined && score>0){
if(typeof m !== 'undefined' && score>0){
clearInterval(m);
m = setInterval(scrollY,Math.abs(100/score+15-0.1*score));}
gfx.setColor(1,1,1);

View File

@ -368,8 +368,8 @@ class TextBox {
// x and y are the center points
this.x = x;
this.y = y;
this.text = (typeof text !== undefined) ? text : "Default";
this.col = (typeof col !== undefined) ? col : red;
this.text = text || "Default";
this.col = col || red;
// console.log(`Constr TextBox ${this.text} -> Center: (${this.x}, ${this.y}) | Col ${this.col}`);
}

1
apps/tabanchi/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.0.1: Initial implementation

47
apps/tabanchi/README.md Normal file
View File

@ -0,0 +1,47 @@
たばんち (tabanchi)
===================
A Tamagotchi clone watch app for the BangleJS2 smartwatch.
Author
------
Written by pancake in 2022, powered by insomnia
Source repository: https://github.com/trufae/tabanchi
Features
--------
* [x] 12/24 clock with HH:mm:ss
* [x] Battery level indicator
* [x] Eating meals and snacks
* [x] Refusing to do things
* [x] Getting sick
* [x] Take a shower
* [x] Switch on/off the light
* [x] Status for happy/hunger/discipline
* [ ] Evolutions
* [ ] Hatching eggs
* [x] Playing a game
* [ ] Education
* [x] Medicine
* [ ] Death
Resources
---------
* Original pixmaps taken from:
- https://www.spriters-resource.com/resources/sheets/141/144400.png
* Espruino Image converter:
- https://www.espruino.com/Image+Converter
* Tamagotchi Essentials
- https://tamagotchi.fandom.com/wiki/Tamagotchi_(1996_Pet)
* Tamagotchi Emulator Source (Java)
- https://gist.github.com/aerospark/80c60e801398fd961e3f
Screenshots
-----------
![tama on bangle](screenshot.jpg)

View File

@ -0,0 +1 @@
atob("MDDBAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//gAAAAD//gAAAAD//gAAAAf//8AAAAf//8AAAAf//8AAAD/////gAD/////gAD/////gAf/////8Af/////8Af/////8D//////8D//////8D//////8D//////8D//////8D//////8D//////8D//////8D//////8D//////8D//////8D//////8f//////gf//////gf//////gD/////gAD/////gAD/////gAAf///8AAAf///8AAAf///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")

1603
apps/tabanchi/app.js Normal file

File diff suppressed because it is too large Load Diff

BIN
apps/tabanchi/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

View File

@ -0,0 +1,31 @@
{
"id": "tabanchi",
"name": "Tabanchi",
"shortName": "Tabanchi",
"version": "0.0.1",
"type": "app",
"description": "Tamagotchi WatchApp",
"icon": "app.png",
"allow_emulator": true,
"tags": "watch, pet",
"supports": [
"BANGLEJS2"
],
"readme": "README.md",
"storage": [
{
"name": "tabanchi.app.js",
"url": "app.js"
},
{
"name": "tabanchi.img",
"url": "app-icon.js",
"evaluate": true
}
],
"screenshots": [
{
"url": "screenshot.jpg"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

View File

@ -0,0 +1,13 @@
{ "id": "widslimbat",
"name": "Slim battery widget with cells",
"shortName":"Slim battery with cells",
"version":"0.01",
"description": "A small (13px wide) battery widget with cells",
"icon": "widget.png",
"type": "widget",
"tags": "widget",
"supports" : ["BANGLEJS2"],
"storage": [
{"name":"widslimbat.wid.js","url":"widget.js"}
]
}

55
apps/widslimbat/widget.js Normal file
View File

@ -0,0 +1,55 @@
(() => {
const intervalLow = 60000; // update time when not charging
const intervalHigh = 2000; // update time when charging
const outline = atob("CRSBAD4AP/AYDAYDAYDAYDAYDAYDAYDAYD/w");
let COLORS = {
'black': g.theme.dark ? "#fff" : "#000",
'charging': "#0f0",
'low': "#f00",
};
function draw() {
var i;
var oCol = COLORS.low;
var cCol = COLORS.low;
var nCells = 0;
const bat = E.getBattery();
if (bat>5) {
oCol = COLORS.black;
nCells = 1 + Math.floor((bat-6)/19);
}
if (nCells>1)
cCol = COLORS.black;
if (Bangle.isCharging())
oCol = COLORS.charging;
g.reset();
g.setColor(oCol).drawImage(outline,this.x+2,this.y+2);
for (i=0;i<nCells;i++) {
var x = this.x+2+2;
var y = this.y+16+2-i*3;
g.setColor(cCol).drawRect(x,y,x+4,y+1);
}
if (Bangle.isCharging()) {
changeInterval(id,intervalHigh);
} else {
changeInterval(id,intervalLow);
}
}
Bangle.on("charging",function(charging) {
if (charging) Bangle.buzz();
WIDGETS["widslimbat"].draw();
});
Bangle.on('lcdPower',function(on) {
WIDGETS["widslimbat"].draw();
});
var id = setInterval(()=>WIDGETS["widslimbat"].draw(),intervalLow);
WIDGETS["widslimbat"]={
area:"tr",
width:13,
draw:draw
};
})();

BIN
apps/widslimbat/widget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -3,8 +3,13 @@
"description": "Bangle.js App Loader (and Apps)",
"author": "Gordon Williams <gw@pur3.co.uk> (http://espruino.com)",
"version": "0.0.1",
"license": "MIT",
"repository": "https://github.com/espruino/BangleApps",
"devDependencies": {
"eslint": "7.1.0"
"eslint": "^8.14.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0",
"npm-watch": "^0.11.0"
},
"scripts": {
"lint-apps": "eslint ./apps --ext .js",
@ -18,8 +23,5 @@
},
"dependencies": {
"acorn": "^7.2.0"
},
"devDpendencies": {
"npm-watch": "^0.11.0"
}
}