view: replay current media on blitter change #1111

This commit is contained in:
nick black 2020-11-12 13:41:10 -05:00
parent 92add03a30
commit c9d6809014
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 5 additions and 3 deletions

View File

@ -633,6 +633,7 @@ int fpsgraph_init(struct notcurses* nc){
memset(&opts, 0, sizeof(opts));
opts.flags = NCPLOT_OPTION_LABELTICKSD | NCPLOT_OPTION_EXPONENTIALD;
opts.legendstyle = NCSTYLE_ITALIC;
opts.gridtype = NCBLIT_3x2;
opts.title = "frames per second";
channels_set_fg_rgb8(&opts.minchannels, 0x80, 0x80, 0xff);
channels_set_bg_rgb(&opts.minchannels, 0x201020);

View File

@ -304,7 +304,7 @@ auto main(int argc, char** argv) -> int {
if(r == 0){
vopts.blitter = marsh.blitter;
if(!loop){
stdn->printf(0, NCAlign::Center, "press any key to advance");
stdn->printf(0, NCAlign::Center, "press key to advance");
if(!nc.render()){
failed = true;
break;
@ -314,10 +314,10 @@ auto main(int argc, char** argv) -> int {
failed = true;
break;
}else if(ie == 'q'){
break;
goto done;
}else if(ie >= '0' && ie <= '8'){
--i; // rerun same input with the new blitter
vopts.blitter = static_cast<ncblitter_e>(ie - '0');
vopts.blitter = blitter = static_cast<ncblitter_e>(ie - '0');
}else if(ie == NCKey::Resize){
--i; // rerun with the new size
if(!nc.refresh(&dimy, &dimx)){
@ -337,6 +337,7 @@ auto main(int argc, char** argv) -> int {
}
}
}
done:
if(!nc.stop()){
return EXIT_FAILURE;
}