Something like that would be very nice! Some thoughts:
Bangle.APP
Bangle.WIDGETS
Bangle.loadWidgets()
x,y,w,h
*Rect
x1,y1,x2,y2
g.fillRect()
Also: x,y,w,h feels neater, but will make apps calculate a lot of x+w-1, whereas x2 wouldn't have the off-by-one problems, from the above example:
x+w-1
x2
var dim = Bangle.getAppRect(); g.clearRect(dim.x, dim.y, dim.w, dim.h); // wrong g.clearRect(dim.x, dim.y, dim.w, dim.h + dim.y); // also wrong :-( g.clearRect(dim.x, dim.y, dim.x + dim.w - 1, dim.h + dim.y -1 ); // correct // vs g.clearRect(dim.x1, dim.y1, dim.x2, dim.y2);
Same goes for
var app = Bangle.getAppRect(); g.setFontAlign(1, 1); // right,bottom g.drawString('bottom right', app.x+app.w-1, app.y+app.h-1); // vs g.drawString('bottom right', app.x2, app.y2);
@rigrig started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Something like that would be very nice!
Some thoughts:
Bangle.APP
, as we already haveBangle.WIDGETS
?Bangle.loadWidgets()
.x,y,w,h
looks nice, but if something is called*Rect
I would expectx1,y1,x2,y2
, likeg.fillRect()
.Also:
x,y,w,h
feels neater, but will make apps calculate a lot ofx+w-1
, whereasx2
wouldn't have the off-by-one problems, from the above example:Same goes for