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

master
Gordon Williams 2022-03-22 09:49:05 +00:00
commit 7d78aa6bd1
39 changed files with 251 additions and 104 deletions

View File

@ -1,3 +1,4 @@
0.01: New App!
0.02: Fixed issue with wrong device informations
0.03: Ensure manufacturer:undefined doesn't overflow screen
0.04: Set Bangle.js 2 compatible, show widgets

View File

@ -5,6 +5,7 @@ let menu = {
function showMainMenu() {
menu["< Back"] = () => load();
Bangle.drawWidgets();
return E.showMenu(menu);
}
@ -55,5 +56,6 @@ function waitMessage() {
E.showMessage("scanning");
}
Bangle.loadWidgets();
scan();
waitMessage();

View File

@ -2,11 +2,11 @@
"id": "bledetect",
"name": "BLE Detector",
"shortName": "BLE Detector",
"version": "0.03",
"version": "0.04",
"description": "Detect BLE devices and show some informations.",
"icon": "bledetect.png",
"tags": "app,bluetooth,tool",
"supports": ["BANGLEJS"],
"supports": ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"bledetect.app.js","url":"bledetect.js"},

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Removed "wake LCD on face-up"-feature: A watch-face should not set things like "wake LCD on face-up".
0.03: Fix the clock for dark mode.

View File

@ -76,7 +76,7 @@ function draw_clock(){
// g.drawLine(clock_center.x - radius, clock_center.y, clock_center.x + radius, clock_center.y);
// g.drawLine(clock_center.x, clock_center.y - radius, clock_center.x, clock_center.y + radius);
g.setColor(g.theme.fg);
g.setColor(g.theme.dark ? g.theme.bg : g.theme.fg);
let ticks = [0, 90, 180, 270];
ticks.forEach((item)=>{
let agl = item+180;
@ -92,13 +92,13 @@ function draw_clock(){
let minute_agl = minute_angle(date);
g.drawImage(hour_hand, hour_pos_x(hour_agl), hour_pos_y(hour_agl), {rotate:hour_agl*p180}); //
g.drawImage(minute_hand, minute_pos_x(minute_agl), minute_pos_y(minute_agl), {rotate:minute_agl*p180}); //
g.setColor(g.theme.fg);
g.setColor(g.theme.dark ? g.theme.bg : g.theme.fg);
g.fillCircle(clock_center.x, clock_center.y, 6);
g.setColor(g.theme.bg);
g.setColor(g.theme.dark ? g.theme.fg : g.theme.bg);
g.fillCircle(clock_center.x, clock_center.y, 3);
// draw minute ticks. Takes long time to draw!
g.setColor(g.theme.fg);
g.setColor(g.theme.dark ? g.theme.bg : g.theme.fg);
for (var i=0; i<60; i++){
let agl = i*6+180;
g.drawImage(tick1.asImage(), rotate_around_x(big_wheel_x(i*6), agl, tick1), rotate_around_y(big_wheel_y(i*6), agl, tick1), {rotate:agl*p180});

View File

@ -1,7 +1,7 @@
{
"id": "crowclk",
"name": "Crow Clock",
"version": "0.02",
"version": "0.03",
"description": "A simple clock based on Bold Clock that has MST3K's Crow T. Robot for a face",
"icon": "crow_clock.png",
"screenshots": [{"url":"screenshot_crow.png"}],

View File

@ -8,3 +8,4 @@
0.08: Optimize line wrapping for Bangle 2
0.09: fix the trasparent widget bar if there are no widgets for Bangle 2
0.10: added "one click exit" setting for Bangle 2
0.11: Fix bangle.js 1 white icons not displaying

View File

@ -48,6 +48,7 @@ function draw_icon(p,n,selected) {
var x = (n%3)*80;
var y = n>2?130:40;
(selected?g.setColor(0.3,0.3,0.3):g.setColor(0,0,0)).fillRect(x,y,x+79,y+89);
g.setColor(g.theme.fg);
g.drawImage(s.read(apps[p*6+n].icon),x+10,y+10,{scale:1.25});
g.setColor(-1).setFontAlign(0,-1,0).setFont("6x8",1);
var txt = apps[p*6+n].name.split(" ");

View File

@ -1,7 +1,7 @@
{
"id": "dtlaunch",
"name": "Desktop Launcher",
"version": "0.10",
"version": "0.11",
"description": "Desktop style App Launcher with six (four for Bangle 2) apps per page - fast access if you have lots of apps installed.",
"screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}],
"icon": "icon.png",

View File

@ -1,4 +1,5 @@
0.01: Initial version
0.02: Temporary intermediate version
0.03: Basic colors
0.04: Bug fix score reset after Game Over, new icon
0.04: Bug fix score reset after Game Over, new icon
0.05: Chevron marker on the randomly added square

View File

@ -11,6 +11,8 @@ When two tiles with the same number are squashed together they will add up as ex
**3 + 3 = 4** or **C + C = D** which is a representation of **2^3 + 2^3 = 2^4 = 16**
After each move a new tile will be added on a random empty square. The value can be 1 or 2, and will be marked with a chevron.
So you can continue till you reach **1024** which equals **2^(10)**. So when you reach tile **10** you have won.
The score is maintained by adding the outcome of the sum of all pairs of squashed tiles (4+16+4+8 etc.)
@ -27,5 +29,8 @@ Use the side **BTN** to exit the game, score and tile positions will be saved.
Game 1024 is based on Saming's 2048 and Misho M. Petkovic 1024game.org and conceptually similar to Threes by Asher Vollmer.
![Screenshot from the Banglejs 2 watch with the game in dark theme](./scrnshot_dn_300.jpg)
![Screenshot from the Banglejs 2 watch with the game in light theme](./scrnshot_lc_300.jpg)
In Dark theme with numbers:
![Screenshot from the Banglejs 2 watch with the game in dark theme](./game1024_sc_dump_dark.png)
In Light theme with characters:
![Screenshot from the Banglejs 2 watch with the game in light theme](./game1024_sc_dump_light.png)

View File

@ -17,7 +17,7 @@ const cellChars = [
const maxUndoLevels = 4;
const noExceptions = true;
let charIndex = 0; // plain numbers on the grid
const themeBg = g.theme.bg;
const scores = {
@ -304,13 +304,29 @@ class Cell {
this.previousExpVals=[];
this.idx = idx;
this.cb = cb;
this.isRndm = false;
this.ax = x0;
this.ay = Math.floor(0.2*width+y0);
this.bx = Math.floor(0.3*width+x0);
this.by = Math.floor(0.5*width+y0);
this.cx = x0;
this.cy = Math.floor(0.8*width+y0);
}
getColor(i) {
return cellColors[i >= cellColors.length ? cellColors.length -1 : i];
}
drawBg() {
g.setColor(this.getColor(this.expVal).bg)
.fillRect(this.x0, this.y0, this.x1, this.y1);
debug(()=>console.log("Drawbg!!"));
if (this.isRndm == true) {
debug(()=>console.log('Random: (ax)', this.ax));
g.setColor(this.getColor(this.expVal).bg)
.fillRect(this.x0, this.y0, this.x1, this.y1)
.setColor(themeBg)
.fillPoly([this.cx,this.cy,this.bx,this.by,this.ax,this.ay]);
} else {
g.setColor(this.getColor(this.expVal).bg)
.fillRect(this.x0, this.y0, this.x1, this.y1);
}
}
drawNumber() {
if (this.expVal !== 0) {
@ -346,6 +362,19 @@ class Cell {
this.cb(this.expVal);
}
}
setRndmFalse() {
this.isRndm = false;
}
setRndmTrue() {
this.isRndm = true;
}
drawRndmIndicator(){
if (this.isRndm == true) {
debug(()=>console.log('Random: (ax)', this.ax));
g.setColor(this.getColor(0).bg)
.fillPoly(this.ax,this.ay,this.bx,this.by,this.cx,this.cy);
}
}
}
function undoGame() {
@ -387,11 +416,12 @@ function createGrid () {
}
}
function messageGameOver () {
g.setColor("#1a0d00")
const c = (g.theme.dark) ? {"fg": "#FFFFFF", "bg": "#808080"} : {"fg": "#FF0000", "bg": "#000000"};
g.setColor(c.bg)
.setFont12x20(2).setFontAlign(0,0,0)
.drawString("G A M E", middle.x+13, middle.y-24)
.drawString("O V E R !", middle.x+13, middle.y+24);
g.setColor("#ffffff")
g.setColor(c.fg)
.drawString("G A M E", middle.x+12, middle.y-25)
.drawString("O V E R !", middle.x+12, middle.y+25);
}
@ -417,11 +447,13 @@ function addRandomNumber() {
if (emptySquaresIdxs.length > 0) {
let randomIdx = Math.floor( emptySquaresIdxs.length * Math.random() );
allSquares[emptySquaresIdxs[randomIdx]].setExpVal(makeRandomNumber());
allSquares[emptySquaresIdxs[randomIdx]].setRndmTrue();
}
}
function drawGrid() {
allSquares.forEach(sq => {
sq.drawBg();
// sq.drawRndmIndicator();
sq.drawNumber();
});
}
@ -497,7 +529,7 @@ function handlePopUpClicks(btn) {
function resetGame() {
g.clear();
scores.reset();
allSquares.forEach(sq => {sq.setExpVal(0);sq.removeUndo();});
allSquares.forEach(sq => {sq.setExpVal(0);sq.removeUndo();sq.setRndmFalse();});
addRandomNumber();
addRandomNumber();
drawGrid();
@ -614,6 +646,7 @@ function runGame(dir){
mover.nonEmptyCells(dir);
mover.mergeEqlCells(dir);
mover.nonEmptyCells(dir);
allSquares.forEach(sq => {sq.setRndmFalse();});
addRandomNumber();
drawGrid();
scores.check();

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,7 +1,7 @@
{ "id": "game1024",
"name": "1024 Game",
"shortName" : "1024 Game",
"version": "0.04",
"version": "0.05",
"icon": "game1024.png",
"screenshots": [ {"url":"screenshot.png" } ],
"readme":"README.md",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

View File

@ -1 +1,2 @@
0.01: New App!
0.02: Make Bangle.js 2 compatible

View File

@ -1,7 +1,86 @@
var storage = require('Storage');
const storage = require('Storage');
const Layout = require("Layout");
const settings = storage.readJSON('setting.json',1) || { HID: false };
const BANGLEJS2 = process.env.HWVERSION == 2;
const sidebarWidth=18;
const buttonWidth = (Bangle.appRect.w-sidebarWidth)/2;
const buttonHeight = (Bangle.appRect.h-16)/2*0.85; // subtract text row and add a safety margin
var sendInProgress = false; // Only send one message at a time, do not flood
var touchBtn2 = 0;
var touchBtn3 = 0;
var touchBtn4 = 0;
var touchBtn5 = 0;
function renderBtnArrows(l) {
const d = g.getWidth() - l.width;
function c(a) {
return {
width: 8,
height: a.length,
bpp: 1,
buffer: (new Uint8Array(a)).buffer
};
}
g.drawImage(c([0,8,12,14,255,14,12,8]),d,g.getHeight()/2);
if (!BANGLEJS2) {
g.drawImage(c([16,56,124,254,16,16,16,16]),d,40);
g.drawImage(c([16,16,16,16,254,124,56,16]),d,194);
}
}
const layoutChilden = [];
if (BANGLEJS2) { // add virtual buttons in display
layoutChilden.push({type:"h", c:[
{type:"btn", width:buttonWidth, height:buttonHeight, label:"BTN2", id:"touchBtn2" },
{type:"btn", width:buttonWidth, height:buttonHeight, label:"BTN3", id:"touchBtn3" },
]});
}
layoutChilden.push({type:"h", c:[
{type:"txt", font:"6x8:2", label:"Joystick" },
]});
if (BANGLEJS2) { // add virtual buttons in display
layoutChilden.push({type:"h", c:[
{type:"btn", width:buttonWidth, height:buttonHeight, label:"BTN4", id:"touchBtn4" },
{type:"btn", width:buttonWidth, height:buttonHeight, label:"BTN5", id:"touchBtn5" },
]});
}
const layout = new Layout(
{type:"h", c:[
{type:"v", width:Bangle.appRect.w-sidebarWidth, c: layoutChilden},
{type:"custom", width:18, height: Bangle.appRect.h, render:renderBtnArrows }
]}
);
function isInBox(box, x, y) {
return x >= box.x && x < box.x+box.w && y >= box.y && y < box.y+box.h;
}
if (BANGLEJS2) {
Bangle.on('drag', function(event) {
if (event.b == 0) { // release
touchBtn2 = touchBtn3 = touchBtn4 = touchBtn5 = 0;
} else if (isInBox(layout.touchBtn2, event.x, event.y)) {
touchBtn2 = 1;
touchBtn3 = touchBtn4 = touchBtn5 = 0;
} else if (isInBox(layout.touchBtn3, event.x, event.y)) {
touchBtn3 = 1;
touchBtn2 = touchBtn4 = touchBtn5 = 0;
} else if (isInBox(layout.touchBtn4, event.x, event.y)) {
touchBtn4 = 1;
touchBtn2 = touchBtn3 = touchBtn5 = 0;
} else if (isInBox(layout.touchBtn5, event.x, event.y)) {
touchBtn5 = 1;
touchBtn2 = touchBtn3 = touchBtn4 = 0;
} else {
// outside any buttons, release all
touchBtn2 = touchBtn3 = touchBtn4 = touchBtn5 = 0;
}
});
}
const sendHid = function (x, y, btn1, btn2, btn3, btn4, btn5, cb) {
try {
@ -20,31 +99,17 @@ const sendHid = function (x, y, btn1, btn2, btn3, btn4, btn5, cb) {
function drawApp() {
g.clear();
g.setFont("6x8",2);
g.setFontAlign(0,0);
g.drawString("Joystick", 120, 120);
const d = g.getWidth() - 18;
function c(a) {
return {
width: 8,
height: a.length,
bpp: 1,
buffer: (new Uint8Array(a)).buffer
};
}
g.drawImage(c([16,56,124,254,16,16,16,16]),d,40);
g.drawImage(c([16,16,16,16,254,124,56,16]),d,194);
g.drawImage(c([0,8,12,14,255,14,12,8]),d,116);
Bangle.loadWidgets();
Bangle.drawWidgets();
layout.render();
}
function update() {
const btn1 = BTN1.read();
const btn2 = BTN2.read();
const btn3 = BTN3.read();
const btn4 = BTN4.read();
const btn5 = BTN5.read();
const btn1 = BTN1 ? BTN1.read() : 0;
const btn2 = !BANGLEJS2 ? BTN2.read() : touchBtn2;
const btn3 = !BANGLEJS2 ? BTN3.read() : touchBtn3;
const btn4 = !BANGLEJS2 ? BTN4.read() : touchBtn4;
const btn5 = !BANGLEJS2 ? BTN5.read() : touchBtn5;
const acc = Bangle.getAccel();
var x = acc.x*-127;
var y = acc.y*-127;

View File

@ -2,11 +2,11 @@
"id": "hidjoystick",
"name": "Bluetooth Joystick",
"shortName": "Joystick",
"version": "0.01",
"description": "Emulates a 2 axis/5 button Joystick using the accelerometer as stick input and buttons 1-3, touch left as button 4 and touch right as button 5.",
"version": "0.02",
"description": "Emulates a 2 axis/5 button Joystick using the accelerometer as stick input and buttons 1-3, touch left as button 4 and touch right as button 5. On Bangle.js 2 buttons 2-5 are emulated with the touchscreen.",
"icon": "app.png",
"tags": "bluetooth",
"supports": ["BANGLEJS"],
"supports": ["BANGLEJS", "BANGLEJS2"],
"storage": [
{"name":"hidjoystick.app.js","url":"app.js"},
{"name":"hidjoystick.img","url":"app-icon.js","evaluate":true}

View File

@ -1 +1,2 @@
0.01: First release
0.02: Make sure to reset turns

View File

@ -3,7 +3,7 @@
"name": "Classic Mind Game",
"shortName":"Master Mind",
"icon": "mmind.png",
"version":"0.01",
"version":"0.02",
"description": "This is the classic game for masterminds",
"screenshots": [{"url":"screenshot_mmind.png"}],
"type": "app",

View File

@ -172,6 +172,7 @@ Bangle.on('touch', function(zone,e) {
break;
case 4:
//new game
turn = 0;
play = [-1,-1,-1,-1];
game = [];
endgame=false;
@ -189,10 +190,3 @@ Bangle.on('touch', function(zone,e) {
game = [];
get_secret();
draw();
//Bangle.loadWidgets();
//Bangle.drawWidgets();

View File

@ -29,11 +29,11 @@ function calc_ess(val) {
if (nonmot) {
slsnds+=1;
if (slsnds >= sleepthresh) {
return true; // awake
return true; // sleep
}
} else {
slsnds=0;
return false; // sleep
return false; // awake
}
}
}

View File

@ -1,4 +1,6 @@
0.01: Initial version
0.02: Add battery level
0.03: Fix battery display when full
0.03: Fix battery display when full (incorporating code by Ronin0000)
0.04: Add support for settings
0.05: Add ability to change background (3bit or 4bit)
0.06: Replace battery text with image

View File

@ -4,13 +4,16 @@ Just a simple watch face for the Banglejs2.
It shows battery level in the upper left corner, date information in the upper right, and time information in the bottom.
![](screenshot.png)
![](screenshot0.png)
![](screenshot1.png)
## Settings
**Analog Clock:**
**Analog Clock:** *Not yet implemented.*
**Human Readable Date:** When the setting is on, the date is shown in a more human-friendly format (e.g. "Oct 2"), otherwise the date is shown in a standard format (e.g. "02/10"). Default is off.
**Background:** When the setting is set as "3bit", a background with more accurate colors is chosen for the watchface. Otherwise, it uses a background following the 16-bit Mac Color Palette.
**Date Format:** When the setting is set as "Long", the date is shown in a more human-friendly format (e.g. "Oct 2"), otherwise the date is shown in a standard format (e.g. "02/10"). Default is off.
**Show Week Info:** When the setting is on, the weekday and week number are shown in the upper right box. When the setting is off, the full year is shown instead. Default is off.
@ -20,4 +23,4 @@ It shows battery level in the upper left corner, date information in the upper r
Monogram Watch Face can be selected as the default clock or it can be run manually from the launcher. Its settings can be accessed and changed via the relevant menu.
Tapping on the "Alerts" area will replace the current time display with the time of the most immediate alert.
*Tapping on the "Alerts" area will replace the current time display with the time of the most immediate alert.* - *Feature not implemented yet.*

View File

@ -1,23 +1,23 @@
const SETTINGSFILE = "smclock.json";
const background = {
width: 176,
height: 176,
bpp: 3,
transparent: 1,
buffer: require("heatshrink").decompress(
atob(
"/4A/AH4ACUb8H9MkyVJAThB/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/INP/AH4A/AAX8Yz4Afn5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/INI="
)
),
const image3bit = {
width : 176, height : 176, bpp : 3,
transparent : 1,
buffer : require("heatshrink").decompress(atob("/4A/AH4AC23btoCct/pkmSpICcIP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5Bp/4A/AH4AC/kAAH0/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5BpA="))
};
const image4bit = {
width : 176, height : 176, bpp : 4,
transparent : 1,
buffer : require("heatshrink").decompress(atob("/4A/AH4Au1QAp1/2swApK/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K+//AH4A/AF8AAH4AUK/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/AA=="))
};
const monthName = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
const weekday = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
// dynamic variables
var batLevel = -1;
var batColor = [0, 0, 0];
var batColor = "";
// settings variables
var backgroundImage;
var dateFormat;
var drawInterval;
var pollInterval;
@ -31,6 +31,7 @@ function loadSettings() {
function def(value, def) {return value !== undefined ? value : def;}
var settings = require("Storage").readJSON(SETTINGSFILE, true) || {};
backgroundImage = def(settings.backgroundImage, "3bit");
dateFormat = def(settings.dateFormat, "Short");
drawInterval = def(settings.drawInterval, 10);
pollInterval = def(settings.pollInterval, 60);
@ -67,23 +68,29 @@ function getBatteryColor(level) {
level = batLevel;
}
if (level > 80) {
color = [0, 0, 1];
color = "#00f";
} else if (level > 60) {
color = [0, 1, 1];
color = "#0ff";
} else if (level > 40) {
color = [0, 1, 0];
color = "#0f0";
} else if (level > 20) {
color = [1, 1, 0];
color = "#f40";
} else {
color = [1, 0, 0];
color = "f00";
}
return color;
}
function draw() {
var background;
if (backgroundImage == "3bit") {
background = image3bit;
} else {
background = image4bit;
}
g.drawImage(background);
const color = getBatteryColor(batLevel);
batColor = getBatteryColor(batLevel);
var bat = "";
const d = new Date();
const day = d.getDate();
@ -95,32 +102,38 @@ function draw() {
const m = d.getMinutes();
const time = d02(h) + ":" + d02(m);
if (E.getBattery() < 100) {
bat = d02(E.getBattery()) + "%";
} else {
bat = E.getBattery() + "%";
}
g.reset();
// draw battery info
g.setColor(1, 1, 1);
var x = 12;
var y = 16;
if (Bangle.isCharging()) {
g.setColor("#ff0").drawImage(atob("DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
} else {
g.clearRect(x,y,x+14,y+24);
g.setColor("#000").fillRect(x+2,y+2,x+12,y+22).clearRect(x+4,y+4,x+10,y+20).fillRect(x+5,y+1,x+9,y+2);
g.setColor(batColor).fillRect(x+4,y+20-(batLevel*16/100),x+10,y+20);
}
if (Bangle.isCharging()) {
g.setColor("#ff0");
} else {
g.setColor(batColor);
}
if (useVectorFont == true) {
g.setFont("Vector", 16);
g.drawString("Bat:", 12, 22, false);
} else {
g.setFont("4x6", 2);
g.drawString("Bat:", 10, 22, false);
g.setFont("4x6", 3);
}
g.setColor(color[0], color[1], color[2]);
if (batLevel < 100) {
g.drawString(bat, 52, 22, false);
bat = d02(batLevel) + "%";
g.drawString(bat, 50, 22, false);
} else {
g.drawString(bat, 46, 22, false);
bat = "100%";
g.drawString(bat, 40, 22, false);
}
// draw date info
g.setColor(0, 0, 0);
g.setColor("#000");
if (useVectorFont == true) {
g.setFont("Vector", 20);
} else {
@ -136,7 +149,7 @@ function draw() {
// draw week info
if (showWeekInfo == true) {
date2 = weekday[d.getDay()] + " " + d02(week)
date2 = weekday[d.getDay()] + " " + d02(week);
if (useVectorFont == true) {
g.setFont("Vector", 18);
} else {
@ -155,7 +168,7 @@ function draw() {
}
// draw time
g.setColor(1, 1, 1);
g.setColor("#fff");
if (useVectorFont == true) {
g.setFont("Vector", 60);
g.drawString(time, 10, 108, false);

View File

@ -3,13 +3,13 @@
"name": "Monogram Watch Face",
"shortName": "MonoClock",
"icon": "app.png",
"screenshots": [{ "url": "screenshot.png" }],
"screenshots": [{ "url": "screenshot0.png" }, {"url": "screenshot1.png" }],
"version": "0.04",
"description": "A simple watchface based on my stylised monogram.",
"type": "clock",
"tags": "clock",
"readme": "README.md",
"supports": ["BANGLEJS", "BANGLEJS2"],
"supports": ["BANGLEJS2"],
"allow_emulator": true,
"storage": [
{ "name": "smclock.app.js", "url": "app.js" },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -52,6 +52,7 @@
writeSettings();
},
},
"Background": stringInSettings("backgroundImage", ["3bit", "4bit"]),
Date: stringInSettings("dateFormat", ["Long", "Short"]),
"Draw Interval": {
value: settings.drawInterval,

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Rename "Activity" in "Motion" and display the true values for it
0.02: Rename "Activity" in "Motion" and display the true values for it
0.03: Add Banglejs 1 compatibility

View File

@ -1,16 +1,28 @@
var locale = require("locale");
var fontColor = g.theme.dark ? "#0f0" : "#000";
var paddingY = 2;
var font6x8At4Size = 32;
var font6x8At2Size = 18;
var heartRate = 0;
// handling the differents versions of the Banglejs smartwatch
if (process.env.HWVERSION == 1){
var paddingY = 3;
var font6x8At4Size = 48;
var font6x8At2Size = 27;
var font6x8FirstTextSize = 6;
var font6x8DefaultTextSize = 3;
}
else{
var paddingY = 2;
var font6x8At4Size = 32;
var font6x8At2Size = 18;
var font6x8FirstTextSize = 4;
var font6x8DefaultTextSize = 2;
}
function setFontSize(pos){
if(pos == 1)
g.setFont("6x8", 4);
g.setFont("6x8", font6x8FirstTextSize);
else
g.setFont("6x8", 2);
g.setFont("6x8", font6x8DefaultTextSize);
}
function clearField(pos){

View File

@ -3,11 +3,12 @@
"name": "Terminal Clock",
"shortName":"Terminal Clock",
"description": "A terminal cli like clock displaying multiple sensor data",
"version":"0.02",
"version":"0.03",
"icon": "app.png",
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"supports": ["BANGLEJS", "BANGLEJS2"],
"allow_emulator": true,
"readme": "README.md",
"storage": [
{"name": "terminalclock.app.js","url": "app.js"},

View File

@ -1,2 +1,3 @@
0.01: Initial creation of the touch timer app
0.02: Add settings menu
0.02: Add settings menu
0.03: Add ability to repeat last timer

View File

@ -141,6 +141,13 @@ var main = () => {
if (buzzCount >= settings.buzzCount) {
clearInterval(buzzIntervalId);
buzzIntervalId = undefined;
buttonStartPause.value = "REPEAT";
buttonStartPause.draw();
buttonStartPause.value = "START";
timerCountDown = undefined;
timerEdit.draw();
return;
} else {
Bangle.buzz(settings.buzzDuration * 1000, 1);

View File

@ -2,7 +2,7 @@
"id": "touchtimer",
"name": "Touch Timer",
"shortName": "Touch Timer",
"version": "0.02",
"version": "0.03",
"description": "Quickly and easily create a timer with touch-only input. The time can be easily set with a number pad.",
"icon": "app.png",
"tags": "tools",