Merge pull request #503 from nebbishhacker/blobclk

blobclk: Adapt to fillPoly changes
pull/504/head^2
Gordon Williams 2020-06-14 16:27:22 +01:00 committed by GitHub
commit 92c731e3e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -869,7 +869,7 @@
"name": "Large Digit Blob Clock", "name": "Large Digit Blob Clock",
"shortName" : "Blob Clock", "shortName" : "Blob Clock",
"icon": "clock-blob.png", "icon": "clock-blob.png",
"version":"0.03", "version":"0.04",
"description": "A clock with big digits", "description": "A clock with big digits",
"tags": "clock", "tags": "clock",
"type":"clock", "type":"clock",

View File

@ -2,3 +2,4 @@
Only draw widgets after clearing screen - they update automatically Only draw widgets after clearing screen - they update automatically
Remove 'faceUp' check as it's automatic Remove 'faceUp' check as it's automatic
0.03: Modified for use with new bootloader and firmware 0.03: Modified for use with new bootloader and firmware
0.04: Modified to account for changes in the behavior of Graphics.fillPoly

View File

@ -18,8 +18,8 @@ function flip() {
g.drawImage({width:buf.getWidth(),height:buf.getHeight(),buffer:buf.buffer},55,26); g.drawImage({width:buf.getWidth(),height:buf.getHeight(),buffer:buf.buffer},55,26);
} }
function drawPixel(ox,oy,x,y,r,p) { function drawPixel(ox,oy,x,y,r,p) {
let x1 = ox+x*(r*2+1); let x1 = ox+x*(r*2);
let y1 = oy+y*(r*2+1); let y1 = oy+y*(r*2);
let xmid = x1+r; let xmid = x1+r;
let ymid = y1+r; let ymid = y1+r;
let x2 = xmid+r; let x2 = xmid+r;
@ -27,14 +27,14 @@ function drawPixel(ox,oy,x,y,r,p) {
if (p > 0) { if (p > 0) {
if (p > 1) { if (p > 1) {
buf.setColor(0,0,0); buf.setColor(0,0,0);
buf.fillRect(x1,y1,x2,y2); buf.fillPoly([x1,y1,x2,y1,x2,y2,x1,y2]);
} }
buf.setColor(1,1,1); buf.setColor(1,1,1);
} else { } else {
buf.setColor(0,0,0); buf.setColor(0,0,0);
} }
if (p < 2) { if (p < 2) {
buf.fillRect(x1,y1,x2,y2); buf.fillPoly([x1,y1,x2,y1,x2,y2,x1,y2]);
} else if (p === 2) { } else if (p === 2) {
buf.fillPoly([xmid,y1,x2,y1,x2,y2,x1,y2,x1,ymid]); buf.fillPoly([xmid,y1,x2,y1,x2,y2,x1,y2,x1,ymid]);
} else if (p === 3) { } else if (p === 3) {