mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-23 18:04:05 +02:00
ubb-la/gui.c: show horizontal divisions
This commit is contained in:
parent
5bb086e0e8
commit
acd9fd6673
19
ubb-la/gui.c
19
ubb-la/gui.c
@ -41,6 +41,7 @@
|
||||
#define LEVEL_RGBA 0xffff00ff /* constant level or single change */
|
||||
#define BOUNCE_RGBA 0xff8080ff /* bouncing signal */
|
||||
#define LABEL_RGBA 0xffffffff /* channel label */
|
||||
#define DIV_RGBA 0x808080ff /* divisions */
|
||||
|
||||
#define XCENTER ((XRES+CH_XOFF)/2)
|
||||
|
||||
@ -54,6 +55,9 @@
|
||||
#define CH_SKIP 16
|
||||
#define CH_HEIGHT 8
|
||||
|
||||
#define DIV_X 32
|
||||
#define DIV_Y 6
|
||||
|
||||
#define MAX_ZOOM 3
|
||||
|
||||
#define FREQ_X 0
|
||||
@ -342,6 +346,20 @@ static void show_freq(double freq)
|
||||
}
|
||||
|
||||
|
||||
/* ----- Show a divisions -------------------------------------------------- */
|
||||
|
||||
|
||||
static void show_divisions(void)
|
||||
{
|
||||
int n = (XRES-CH_XOFF)/2/DIV_X;
|
||||
int i;
|
||||
|
||||
for (i = -n; i <= n; i++)
|
||||
vlineColor(surf, XCENTER+i*DIV_X,
|
||||
ch_y(0, 1)-DIV_Y, ch_y(3, 0)+DIV_Y, DIV_RGBA);
|
||||
}
|
||||
|
||||
|
||||
/* ----- Main event loop --------------------------------------------------- */
|
||||
|
||||
|
||||
@ -366,6 +384,7 @@ void gui(const uint8_t *buf, int skip, int nibbles, double freq)
|
||||
clear();
|
||||
for (i = 0; i != 4; i++)
|
||||
textf(0, ch_y(i, 1), LABEL_RGBA, "CH%d", i);
|
||||
show_divisions();
|
||||
show_buffer(buf, skip, nibbles, CH_XOFF, XRES, zoom, pos);
|
||||
show_freq(freq);
|
||||
update();
|
||||
|
Loading…
Reference in New Issue
Block a user