vizdirect PoC: always call ncdirect_stop()

This commit is contained in:
nick black 2021-01-19 05:53:55 -05:00
parent 421f450526
commit 7f1d208a0a
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -14,53 +14,57 @@ int main(void){
}
if(!ncdirect_canopen_images(n)){
fprintf(stderr, "This notcurses was not build with multimedia support.\n");
return EXIT_FAILURE;
goto err;
}
ncdirect_set_fg_rgb8(n, 0xff, 0, 0xff);
ncdirect_set_bg_rgb8(n, 0, 0xff, 0);
ncdirect_printf_aligned(n, -1, NCALIGN_CENTER, "let's play!");
if(ncdirect_render_image(n, "../data/normal.png", NCALIGN_LEFT,
NCBLIT_DEFAULT, NCSCALE_STRETCH)){
return EXIT_FAILURE;
goto err;
}
if(ncdirect_render_image(n, "../data/normal.png", NCALIGN_CENTER,
NCBLIT_DEFAULT, NCSCALE_STRETCH)){
return EXIT_FAILURE;
goto err;
}
if(ncdirect_render_image(n, "../data/normal.png", NCALIGN_RIGHT,
NCBLIT_DEFAULT, NCSCALE_STRETCH)){
return EXIT_FAILURE;
goto err;
}
sleep(1);
if(ncdirect_clear(n)){
return EXIT_FAILURE;
goto err;
}
if(ncdirect_render_image(n, "../data/changes.jpg", NCALIGN_LEFT,
NCBLIT_DEFAULT, NCSCALE_SCALE)){
return EXIT_FAILURE;
goto err;
}
if(ncdirect_render_image(n, "../data/changes.jpg", NCALIGN_CENTER,
NCBLIT_DEFAULT, NCSCALE_SCALE)){
return EXIT_FAILURE;
goto err;
}
if(ncdirect_render_image(n, "../data/changes.jpg", NCALIGN_RIGHT,
NCBLIT_DEFAULT, NCSCALE_SCALE)){
return EXIT_FAILURE;
goto err;
}
sleep(1);
if(ncdirect_clear(n)){
return EXIT_FAILURE;
goto err;
}
if(ncdirect_render_image(n, "../data/warmech.bmp", NCALIGN_RIGHT,
NCBLIT_DEFAULT, NCSCALE_NONE)){
return EXIT_FAILURE;
goto err;
}
if(ncdirect_render_image(n, "../data/warmech.bmp", NCALIGN_LEFT,
NCBLIT_DEFAULT, NCSCALE_NONE)){
return EXIT_FAILURE;
goto err;
}
if(ncdirect_stop(n)){
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
err:
ncdirect_stop(n);
return EXIT_FAILURE;
}