mirror of https://github.com/espruino/BangleApps
remove old code and fix typos
parent
ec9935687e
commit
b2e2d15ee1
|
@ -1,70 +1,63 @@
|
|||
/* jshint esversion: 6 */
|
||||
(function() {
|
||||
const xyMin = 0;
|
||||
const xyMax = g.getWidth();
|
||||
|
||||
//const appScreen = { x1: xyMin, y1: 24, x2: xyMax, y2: xyMax };
|
||||
const timeFontSize = 6;
|
||||
const dateFontSize = 3;
|
||||
const gmtFontSize = 2;
|
||||
const font = "6x8";
|
||||
|
||||
const timeFontSize = 6;
|
||||
const dateFontSize = 3;
|
||||
const gmtFontSize = 2;
|
||||
const font = "6x8";
|
||||
const xyCenter = g.getWidth() / 2;
|
||||
const yposTime = 75;
|
||||
const yposDate = 130;
|
||||
const yposYear = 175;
|
||||
const yposGMT = 220;
|
||||
|
||||
const xyCenter = xyMax / 2;
|
||||
const yposTime = 75;
|
||||
const yposDate = 130;
|
||||
const yposYear = 175;
|
||||
const yposGMT = 220;
|
||||
function drawSimpleClock() {
|
||||
|
||||
function drawSimpleClock() {
|
||||
// get date
|
||||
var d = new Date();
|
||||
var da = d.toString().split(" ");
|
||||
|
||||
// get date
|
||||
var d = new Date();
|
||||
var da = d.toString().split(" ");
|
||||
// drawSting centered
|
||||
g.setFontAlign(0, 0);
|
||||
|
||||
//g.clearRect(appScreen.x1, appScreen.y1, appScreen.x2, appScreen.y2);
|
||||
// draw time
|
||||
var time = da[4].substr(0, 5);
|
||||
g.setFont(font, timeFontSize);
|
||||
g.drawString(time, xyCenter, yposTime, true);
|
||||
|
||||
// drawSting centered
|
||||
g.setFontAlign(0, 0);
|
||||
// draw Day, name of month, Date
|
||||
var date = [da[0], da[1], da[2]].join(" ");
|
||||
g.setFont(font, dateFontSize);
|
||||
|
||||
// draw time
|
||||
var time = da[4].substr(0, 5);
|
||||
//g.clearRect(xyMin, yposTime, xyMax, yposTime + g.getFontHeight());
|
||||
g.setFont(font, timeFontSize);
|
||||
g.drawString(time, xyCenter, yposTime,true);
|
||||
g.drawString(date, xyCenter, yposDate, true);
|
||||
|
||||
// draw Day, name of month, Date
|
||||
var date = [ da[0], da[1], da[2] ].join(" ");
|
||||
g.setFont(font, dateFontSize);
|
||||
//g.clearRect(xyMin, yposDate, xyMax, yposDate + g.getFontHeight());
|
||||
g.drawString(date, xyCenter, yposDate,true);
|
||||
// draw year
|
||||
g.setFont(font, dateFontSize);
|
||||
g.drawString(d.getFullYear(), xyCenter, yposYear, true);
|
||||
|
||||
// draw year
|
||||
g.setFont(font, dateFontSize);
|
||||
//g.clearRect(xyMin, yposYear, xyMax, yposDate + g.getFontHeight());
|
||||
g.drawString(d.getFullYear(), xyCenter, yposYear,true);
|
||||
// draw gmt
|
||||
var gmt = da[5];
|
||||
g.setFont(font, gmtFontSize);
|
||||
g.drawString(gmt, xyCenter, yposGMT, true);
|
||||
|
||||
// draw gmt
|
||||
var gmt = da[5];
|
||||
g.setFont(font, gmtFontSize);
|
||||
g.drawString(gmt, xyCenter, yposGMT,true);
|
||||
|
||||
}
|
||||
|
||||
// handle switch display on by pressing BTN1
|
||||
Bangle.on('lcdPower', function(on) {
|
||||
if (on) {
|
||||
drawSimpleClock();
|
||||
drawWidgets();
|
||||
}
|
||||
});
|
||||
|
||||
// clean app screen
|
||||
g.clear();
|
||||
// handle switch display on by pressing BTN1
|
||||
Bangle.on('lcdPower', function(on) {
|
||||
if (on) {
|
||||
drawSimpleClock();
|
||||
drawWidgets();
|
||||
}
|
||||
});
|
||||
|
||||
// refesh every 15 sec
|
||||
setInterval(drawSimpleClock, 15E3);
|
||||
// draw now
|
||||
drawSimpleClock();
|
||||
// clean app screen
|
||||
g.clear();
|
||||
|
||||
// refesh every 15 sec
|
||||
setInterval(drawSimpleClock, 15E3);
|
||||
|
||||
// draw now
|
||||
drawSimpleClock();
|
||||
|
||||
})();
|
Loading…
Reference in New Issue