-
-
@Gordon, off topic, but another thing I was thinking about is to let the user configure all the App settings by an interface.html in the app loader as it is way easier to scroll and type on your phone. Is this something you might want to consider? While I think I will implement the mylocations configuration after my holidays, this config option to all apps would exceed my skills, yet :)
-
-
I just had an idea and wanted to check if you guys think it makes sense:
I use mylocation for my watchface, but it offers only some preset locations + GPS. I think I'd like to give users more influence on the preset values. We could let the user enter their own locations in the app loader, but I don't like the fact that they need to add them with each upload. So, I like the way the Waypointer app handles the custom waypoints. I am thinking it might make sese to borrow that code and add it to mylocation to let the user administer their own location presets. What do you think?
-
-
Found a way - PR pending:
https://github.com/espruino/BangleApps/pull/2041Difference to BJS2 is that if all drinks are 0, it asks for reset because button 2 is needed to exit the app.
-
-
-
-
There ya go @ajkm - your new favorite app :)
-
-
-
To be honest, I get better along without the Layout library :)
I considered using the locales, but for BAC calculation I need a full time element including date to calculate the correct difference. Will work on that.
++ shortening is really necessary in the code clean up I will do when development is stable. Will do that then. Thanks for the suggestions! -
-
-
Lame question as I don't get the concept of the display buffer.
I cuccently dog.setBgColor(g.theme.bg).setColor(g.theme.bg).fillRect(0,145,176,176); //Clear g.setFont("Vector",20).setColor(g.theme.fg); g.drawString(drinks[activeDrink], (40 * (activeDrink + 1)) -20, 165);
But having this fillRect to clear the previous written number feels totally wrong. What is the right way to do it?
-
Pushed a start template to
https://github.com/pebl-hank/BangleApps/tree/DrinkCounter/apps/drinkcounter
all work in progress -
-
-
-
Is there a way to convert e.g.
var FLOORIMG = require("heatshrink").decompress(atob("iEKxH+kklABuLAAlgAAwNFB34OLmAAO0YAO5wAOA"));
to 3bpp without having the original png file?
Also if I change
b = Graphics.createArrayBuffer(178,178,8);
to
b = Graphics.createArrayBuffer(178,178,3);
I get
Uncaught Error: Invalid BPP
It looks fine in B/W though:
b = Graphics.createArrayBuffer(178,178,2,{msb:true}); var gimg = { width:178, height:178, bpp:2, buffer:b.buffer };
Edit:
I now understood that settingvar H = b.getHeight()-24; b.setColor("#ff0000"); b.fillRect(0,0,b.getWidth(),H-1);
instead of
var H = b.getHeight()-24; b.setColor("#71c6cf"); b.fillRect(0,0,b.getWidth(),H-1);
will stop dirthering, but how can I show some shade of grey? Is that not possible?
PS: I intended to let it run in full resolution - but that will be too slow. So I stopped developing that. I's be curious about the Grey thought :)
-
Yeah, well, I am more or less someone who can adjust code. Writing a whole new thing is something I am not that comfortable with.
However, what we need is- 4 way swipe (left/right to select item; up/down to increase/decrease amount)
- Double tap (and confirm) to reset settings
- Making sure you don't accidentally exit the app (remember, you probably had some alcohol for science)
- The calculations
- The images
- A settings page for things like beer size, age, weight, sex etc.
- 4 way swipe (left/right to select item; up/down to increase/decrease amount)
-
I tried to adjust https://banglejs.com/apps/?id=flappy so that it shows full screen on Bangle.js 2.
My code currently is:if (process.env.HWVERSION==2) { b = Graphics.createArrayBuffer(178,178,8); var gimg = { width:178, height:178, bpp:8, buffer:b.buffer }; b.flip = function() { g.drawImage(gimg,0,0); }; } else { b = Graphics.createArrayBuffer(120,120,8); var gimg = { width:120, height:104, bpp:8, buffer:b.buffer }; b.flip = function() { g.drawImage(gimg,0,24,{scale:2}); }; } var BIRDIMG = E.toArrayBuffer(atob("EQyI/v7+/v7+/gAAAAAAAP7+/v7+/v7+/gYG0tLS0gDXAP7+/v7+/v4A0tLS0tIA19fXAP7+/v4AAAAA0tLS0gDX1wDXAP7+ANfX19cA0tLSANfXANcA/v4A19fX19cA0tLSANfX1wD+/gDS19fX0gDS0tLSAAAAAAD+/gDS0tIA0tLS0gDAwMDAwAD+/gAAAM3Nzc0AwAAAAAAA/v7+/v4Azc3Nzc0AwMDAwAD+/v7+/v4AAM3Nzc0AAAAAAP7+/v7+/v7+AAAAAP7+/v7+/g==")) var FLOORIMG = require("heatshrink").decompress(atob("iEKxH+kklABuLAAlgAAwNFB34OLmAAO0YAO5wAOA")); var birdy, birdvy; var floorpos = 0; var running = false; var barriers; var score; function newBarrier(x) { barriers.push({ x1 : x-7, x2 : x+7, y : 20+Math.random()*38, gap : 12+Math.random()*15 }); } function gameStart() { running = true; birdy = 48/2; birdvy = 0; barriers = []; for (var i=38;i<g.getWidth();i+=38) newBarrier(i); score = 0; } function gameStop() { running = false; } function draw() { "ram" var H = b.getHeight()-24; b.setColor("#71c6cf"); b.fillRect(0,0,b.getWidth(),H-1); floorpos++; for (var x=-(floorpos&15);x<b.getWidth();x+=16) b.drawImage(FLOORIMG,x,H); if (!running) { var x = b.getWidth()/2; b.setColor("#000000"); b.setFontAlign(0,0); b.setFont("4x6",2); b.drawString("GAME OVER!",x,20); b.setFont("6x8",1); b.drawString("Score",x,40); b.drawString(score,x,56); b.drawString("Tap screen to",x,76); b.drawString("restart and flap",x,84); b.flip(); return; } score++; birdvy += 0.4; birdvy *= 0.9; birdy += birdvy; if (birdy > H) gameStop(); // draw bird b.drawImage(BIRDIMG, 6,birdy, {rotate:Math.atan2(birdvy,15)}); // draw barriers barriers.forEach(function(r) { r.x1--; r.x2--; var btop = r.y-r.gap; var bbot = r.y+r.gap; b.setColor("#73bf2f"); // middle b.fillRect(r.x1+4, 0, r.x2-4, btop-1); b.fillRect(r.x1+4, bbot, r.x2-4, H-1); b.setColor("#c0f181"); // left b.fillRect(r.x1+1, 0, r.x1+3, btop-1); b.fillRect(r.x1+1, bbot, r.x1+3, H-1); b.setColor("#538917"); // right b.fillRect(r.x2-3, 0, r.x2-1, btop-1); b.fillRect(r.x2-3, bbot, r.x2-1, H-1); b.setColor("#808080"); // outlines b.drawRect(r.x1, btop-5, r.x2, btop); // top b.drawLine(r.x1+1, 0, r.x1+1, btop-6); b.drawLine(r.x2-2, 0, r.x2-2, btop-6); b.drawRect(r.x1, bbot, r.x2, bbot+5); // bottom b.drawLine(r.x1+1, bbot+6, r.x1+1, H-1); b.drawLine(r.x2-1, bbot+6, r.x2-1, H-1); if (r.x1<6 && (birdy-3<btop || birdy+3>bbot)) gameStop(); }); while (barriers.length && barriers[0].x2<=0) { barriers.shift(); newBarrier(g.getWidth()); } b.flip(); } Bangle.on('touch', function(button) { if (!running) { gameStart(); } else { birdvy -= 4; } }); Bangle.loadWidgets(); g.clear(); Bangle.drawWidgets(); b.setBgColor("#e3db9d"); gameStart(); setInterval(draw, 100);
However, the emulator shows these dots instead of a clear screen. Any hints?
-
I am kind of struggeling with RAM issues. The watchface claims low ram after a while. Is there somebody who can check the code for the leak?
https://github.com/espruino/BangleApps/blob/master/apps/hworldclock/app.js
I checked with
So my guess is that the status change from "show every 10 seconds" to "show every second" causes RAM usage. So my theory is that I use and discard the setInterval in a wrong way. Any hints on that?