mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-16 19:25:55 +02:00
ubb-la/gui.c: add small gap (UNIT_GAP) between numbers and units
This commit is contained in:
parent
ba033cc27e
commit
a83d8bf323
@ -67,11 +67,13 @@
|
||||
|
||||
#define MAX_ZOOM 3
|
||||
|
||||
#define UNIT_GAP 2 /* space between number and unit */
|
||||
|
||||
#define FREQ_X 0
|
||||
#define FREQ_Y 220
|
||||
#define INTERVAL_X 0
|
||||
#define INTERVAL_Y 230
|
||||
#define DIV_SAMP_X (80-8)
|
||||
#define DIV_SAMP_X (DIV_INT_X-8)
|
||||
#define DIV_SAMP_Y FREQ_Y
|
||||
#define DIV_INT_X 80
|
||||
#define DIV_INT_Y INTERVAL_Y
|
||||
@ -352,7 +354,7 @@ static void si_text(int x, int y, double v, const char *unit)
|
||||
textf(x, y, TEXT_RGBA, "%3d", (int) (v+0.5));
|
||||
else
|
||||
textf(x, y, TEXT_RGBA, "%3.1f", v);
|
||||
textf(x+3*8, y, UNIT_RGBA, "%s%s", pfx, unit);
|
||||
textf(x+3*8+UNIT_GAP, y, UNIT_RGBA, "%s%s", pfx, unit);
|
||||
}
|
||||
|
||||
|
||||
@ -364,7 +366,7 @@ static void show_freq(double freq, int zoom)
|
||||
si_text(INTERVAL_X, INTERVAL_Y, 1/freq, "s/Sa");
|
||||
div = (DIV_X >> MAX_ZOOM) << (MAX_ZOOM-zoom);
|
||||
textf(DIV_SAMP_X, DIV_SAMP_Y, TEXT_RGBA, "%4d", div);
|
||||
textf(DIV_SAMP_X+4*8, DIV_SAMP_Y, UNIT_RGBA, "Sa/div", div);
|
||||
textf(DIV_SAMP_X+4*8+UNIT_GAP, DIV_SAMP_Y, UNIT_RGBA, "Sa/div", div);
|
||||
si_text(DIV_INT_X, DIV_INT_Y, div/freq, "s/div");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user