rotate PoCPP was basically a PoC, move to src/poc/ #1800

pull/1838/head
nick black 3 years ago
parent 68e498a583
commit a16cd3be31
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1,8 +1,8 @@
#include <cmath> #include <math.h>
#include <cstdio> #include <stdio.h>
#include <cstdlib> #include <stdlib.h>
#include <clocale> #include <locale.h>
#include <cassert> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <notcurses/notcurses.h> #include <notcurses/notcurses.h>
#include "compat/compat.h" #include "compat/compat.h"
@ -20,28 +20,28 @@ int main(int argc, char** argv){
}else if(argc == 2){ }else if(argc == 2){
file = argv[1]; file = argv[1];
} }
notcurses_options opts{}; notcurses_options opts = {};
//opts.loglevel = NCLOGLEVEL_TRACE; //opts.loglevel = NCLOGLEVEL_TRACE;
opts.flags = NCOPTION_INHIBIT_SETLOCALE | NCOPTION_NO_ALTERNATE_SCREEN; opts.flags = NCOPTION_INHIBIT_SETLOCALE | NCOPTION_NO_ALTERNATE_SCREEN;
struct notcurses* nc; struct notcurses* nc;
if((nc = notcurses_init(&opts, nullptr)) == nullptr){ if((nc = notcurses_init(&opts, NULL)) == NULL){
return EXIT_FAILURE; return EXIT_FAILURE;
} }
int dimy, dimx; int dimy, dimx;
struct ncplane* n = ncplane_dup(notcurses_stddim_yx(nc, &dimy, &dimx), nullptr); struct ncplane* n = ncplane_dup(notcurses_stddim_yx(nc, &dimy, &dimx), NULL);
if(!n){ if(!n){
notcurses_stop(nc); notcurses_stop(nc);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
struct ncvisual_options vopts{}; struct ncvisual_options vopts = {};
bool failed = false; bool failed = false;
auto ncv = ncvisual_from_file(file); struct ncvisual* ncv = ncvisual_from_file(file);
if(!ncv){ if(!ncv){
goto err; goto err;
} }
int scaley, scalex; int scaley, scalex;
vopts.n = n; vopts.n = n;
if(ncvisual_render(nc, ncv, &vopts) == nullptr){ if(ncvisual_render(nc, ncv, &vopts) == NULL){
goto err; goto err;
} }
if(notcurses_render(nc)){ if(notcurses_render(nc)){
@ -50,12 +50,12 @@ int main(int argc, char** argv){
clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL); clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);
ncplane_erase(n); ncplane_erase(n);
ncvisual_blitter_geom(nc, ncv, &vopts, nullptr, nullptr, &scaley, &scalex, nullptr); ncvisual_blitter_geom(nc, ncv, &vopts, NULL, NULL, &scaley, &scalex, NULL);
if(ncvisual_resize(ncv, dimy * scaley, dimx * scalex)){ if(ncvisual_resize(ncv, dimy * scaley, dimx * scalex)){
goto err; goto err;
} }
vopts.n = n; vopts.n = n;
if(ncvisual_render(nc, ncv, &vopts) == nullptr){ if(ncvisual_render(nc, ncv, &vopts) == NULL){
goto err; goto err;
} }
if(notcurses_render(nc)){ if(notcurses_render(nc)){
@ -75,7 +75,7 @@ int main(int argc, char** argv){
break; break;
} }
struct ncplane* newn; struct ncplane* newn;
if((newn = ncvisual_render(nc, ncv, &vopts)) == nullptr){ if((newn = ncvisual_render(nc, ncv, &vopts)) == NULL){
failed = true; failed = true;
break; break;
} }
Loading…
Cancel
Save