1
0
Fork 0

iconbits: cleanups, finish color selector

master
Pavel Machek 2024-07-19 10:12:57 +02:00
parent aedb898177
commit 9697902e40
1 changed files with 17 additions and 20 deletions

View File

@ -13,6 +13,7 @@
var color = true;
let oldLock = false;
let sg = null;
const top_bar = 20;
function clear(m) {
sg.setColor(1,1,1).fillRect(0,0, font_width, font_height);
@ -61,9 +62,9 @@
}
g.setColor('#fff');
g.fillRect(0, 0, g.getWidth(), 20);
g.setFont('6x8', 2);
g.setFont('Vector', 22);
g.setColor('#000');
g.drawString('PLEASE UNLOCK', 10, 2);
g.drawString('PLEASE\nUNLOCK', 10, 2);
oldLock = true;
}
Bangle.on("lock", function() {
@ -81,7 +82,7 @@ Bangle.on("lock", function() {
}
function selectColor(x) {
if (color) {
i = Math.floor((x - 25) / 4);
i = Math.floor((x - 32) / 4);
kule = toColor(i);
return;
}
@ -164,11 +165,11 @@ Bangle.on("lock", function() {
}
// titlebar
g.setColor(kule[0], kule[1], kule[2]);
g.fillRect(0, 0, g.getWidth(), 20);
g.fillRect(0, 0, g.getWidth(), top_bar);
for (let i = 0; i < 3*3*3; i++) {
r = toColor(i);
g.setColor(r[0], r[1], r[2]);
g.fillRect(25+4*i, 20, 25+4*i+3, 24);
g.fillRect(32+4*i, 12, 32+4*i+3, top_bar);
}
// clear button
g.setColor('#000'); // black
@ -258,7 +259,6 @@ Bangle.on("lock", function() {
oldY = -1;
}, 100);
let top_bar = 20;
// tap and hold the clear button
if (tap.x < 32 && tap.y < top_bar) {
if (tap.b === 1) {
@ -343,8 +343,6 @@ Bangle.on("lock", function() {
print('fi("'+btoa(im)+'");');
print(btoa(require('heatshrink').compress(im)));
}
}
setup("icon");
@ -356,7 +354,6 @@ Bangle.on("lock", function() {
});
drawUtil();
function ft(icon) {
g.reset().clear();
g.setFont("Vector", 26).drawString("Hellord" + icon, 0, 0);