1
0
Fork 0
BangleApps/apps/_example_app/app.js

35 lines
651 B
JavaScript
Raw Normal View History

// place your const, vars, functions or classes here
2022-04-05 15:48:56 +00:00
// clear the screen
g.clear();
var n = 0;
// redraw the screen
function draw() {
g.reset().clearRect(Bangle.appRect);
g.setFont("6x8").setFontAlign(0,0).drawString("Up / Down",g.getWidth()/2,g.getHeight()/2 - 20);
g.setFont("Vector",60).setFontAlign(0,0).drawString(n,g.getWidth()/2,g.getHeight()/2 + 30);
}
// Respond to user input
Bangle.setUI({mode: "updown"}, function(dir) {
if (dir<0) {
n--;
draw();
} else if (dir>0) {
n++;
draw();
} else {
n = 0;
draw();
}
});
2022-04-05 15:48:56 +00:00
// First draw...
draw();
// Load widgets
Bangle.loadWidgets();
Bangle.drawWidgets();