yield: don't print overyield

pull/1016/head
nick black 4 years ago
parent dd53764df2
commit 94aa0aaa76

@ -74,6 +74,9 @@ int yield_demo(struct notcurses* nc){
ncplane_set_bg_rgb(std, 0x10, 0x10, 0x10);
ncplane_set_fg_rgb(std, 0xf0, 0x20, 0x20);
ncplane_set_attr(std, NCSTYLE_BOLD);
if(tfilled > threshold_painted){
tfilled = threshold_painted; // don't allow printing of 100.1% etc
}
ncplane_printf_aligned(std, 3, NCALIGN_CENTER, "Yield: %3.1f%%", ((double)tfilled * 100) / threshold_painted);
ncplane_set_attr(std, NCSTYLE_NONE);
DEMO_RENDER(nc);

Loading…
Cancel
Save