mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
notcurses-demo FPS graph: back to straight seconds
This commit is contained in:
parent
99169aea42
commit
f05f65dc80
@ -29,8 +29,6 @@ static int plot_grab_y = -1;
|
|||||||
// position of the plot *when grab started*
|
// position of the plot *when grab started*
|
||||||
static int plot_pos_y;
|
static int plot_pos_y;
|
||||||
|
|
||||||
#define FPSHZ 2
|
|
||||||
|
|
||||||
#define FPSGRAPH_MAX_COLS 72 // give it some room on each side of an 80-column term
|
#define FPSGRAPH_MAX_COLS 72 // give it some room on each side of an 80-column term
|
||||||
|
|
||||||
// how many columns for runtime?
|
// how many columns for runtime?
|
||||||
@ -587,7 +585,7 @@ int demo_render(struct notcurses* nc){
|
|||||||
if(!plot_hidden){
|
if(!plot_hidden){
|
||||||
ncplane_move_family_top(ncuplot_plane(plot));
|
ncplane_move_family_top(ncuplot_plane(plot));
|
||||||
}
|
}
|
||||||
uint64_t ns = (timespec_to_ns(&ts) - plottimestart) / (NANOSECS_IN_SEC / FPSHZ);
|
uint64_t ns = (timespec_to_ns(&ts) - plottimestart) / NANOSECS_IN_SEC;
|
||||||
ncuplot_add_sample(plot, ns, 1);
|
ncuplot_add_sample(plot, ns, 1);
|
||||||
}
|
}
|
||||||
if(menu){
|
if(menu){
|
||||||
@ -666,7 +664,7 @@ int fpsgraph_init(struct notcurses* nc){
|
|||||||
NCPLOT_OPTION_PRINTSAMPLE;
|
NCPLOT_OPTION_PRINTSAMPLE;
|
||||||
opts.gridtype = NCBLIT_BRAILLE;
|
opts.gridtype = NCBLIT_BRAILLE;
|
||||||
opts.legendstyle = NCSTYLE_ITALIC | NCSTYLE_BOLD;
|
opts.legendstyle = NCSTYLE_ITALIC | NCSTYLE_BOLD;
|
||||||
opts.title = "frames per semisecond";
|
opts.title = "frames per second";
|
||||||
ncchannels_set_fg_rgb8(&opts.minchannels, 0x80, 0x80, 0xff);
|
ncchannels_set_fg_rgb8(&opts.minchannels, 0x80, 0x80, 0xff);
|
||||||
ncchannels_set_bg_rgb(&opts.minchannels, 0x201020);
|
ncchannels_set_bg_rgb(&opts.minchannels, 0x201020);
|
||||||
ncchannels_set_bg_alpha(&opts.minchannels, NCALPHA_BLEND);
|
ncchannels_set_bg_alpha(&opts.minchannels, NCALPHA_BLEND);
|
||||||
|
Loading…
Reference in New Issue
Block a user