ref: e4e53a6530a5be4c393c2146c83f3a7f01fce93f
parent: c72d7aa2b179b0f6b46dcadca28a89edbf31a639
author: rodri <rgl@antares-labs.eu>
date: Fri Dec 20 07:12:44 EST 2024
chrono: true LCD style.
--- a/chrono.c
+++ b/chrono.c
@@ -19,7 +19,7 @@
struct Stopwatch
{uvlong elapsed; /* in ms */
- char hms[3][6+1]; /* HH MM SS.ss */
+ char hms[3][6+1]; /* HH MM SS.sss */
int state;
void (*start)(Stopwatch*);
@@ -79,19 +79,19 @@
int npts;
} segs[NSEGS] = { /* segment parameters */ [TV] { .poly = {- { 1, 0, 1 },- { 1.5, 1, 1 },- { 1.5, 5, 1 },- { 1, 6, 1 },- { 0.5, 5, 1 },- { 0.5, 1, 1 },+ { 1, 0, 1 },+ { 2, 1, 1 },+ { 2, 7, 1 },+ { 1, 8, 1 },+ { 0, 7, 1 },+ { 0, 1, 1 },}, .npts = 6+1 },
[TH] { .npts = 6+1 }, [TD] { .poly = { { 0, 0, 1 },- { 1, 0, 1 },- { 1, 1, 1 },- { 0, 1, 1 },+ { 2, 0, 1 },+ { 2, 2, 1 },+ { 0, 2, 1 },}, .npts = 4+1 },
};
struct {@@ -98,18 +98,18 @@
Point p;
int segtype;
} loc[8] = { /* segment locations (layout) */- { 1, 2, TH }, /* A */- { 6, 1, TV }, /* B */- { 6, 7, TV }, /* C */- { 1, 14, TH }, /* D */- { 0, 7, TV }, /* E */- { 0, 1, TV }, /* F */- { 1, 8, TH }, /* G */- { 8, 13, TD }, /* H (dot) */+ { 2, 3, TH }, /* A */+ { 9, 2, TV }, /* B */+ { 9, 10, TV }, /* C */+ { 2, 19, TH }, /* D */+ { 1, 10, TV }, /* E */+ { 1, 2, TV }, /* F */+ { 2, 11, TH }, /* G */+ { 12, 17, TD }, /* H (dot) */};
Rectangle bbox = { { 0, 0 },- { 9, 14 },+ { 14, 20 },};
Point segpt[7];
double maxlen;
@@ -161,7 +161,7 @@
fillpoly(dst, segpt, segs[loc[i].segtype].npts, 0, fg, ZP);
if(scale > 16)
- poly(dst, segpt, segs[loc[i].segtype].npts, 0, 0, 0, display->black, ZP);
+ poly(dst, segpt, segs[loc[i].segtype].npts, 0, 0, 0, bg, ZP);
}
return Pt(bbox.max.x + 1, bbox.min.y);
@@ -321,7 +321,7 @@
void
redraw(void)
{- draw(screenb, screenb->r, display->black, nil, ZP);
+ draw(screenb, screenb->r, d7bg, nil, ZP);
chrono->draw(chrono, screenb, Pt(10, 10), d7scale);
draw(screen, screen->r, screenb, nil, ZP);
flushimage(display, 1);
@@ -392,8 +392,10 @@
if((kc = initkeyboard(nil)) == nil)
sysfatal("initkeyboard: %r");- d7bg = eallocimage(display, UR, XRGB32, 1, 0x333333FF);
- d7fg = eallocimage(display, UR, XRGB32, 1, DRed);
+// d7bg = eallocimage(display, UR, XRGB32, 1, 0x333333FF);
+// d7fg = eallocimage(display, UR, XRGB32, 1, DRed);
+ d7bg = eallocimage(display, UR, XRGB32, 1, 0xA7AD9FFF);
+ d7fg = eallocimage(display, UR, XRGB32, 1, DBlack);
initscreenb();
drawc = chancreate(sizeof(void*), 1);
--
⑨