2019-11-17 15:25:40 +00:00
|
|
|
#include <stdio.h>
|
2019-11-23 23:34:06 +00:00
|
|
|
#include <string.h>
|
2019-11-21 13:19:57 +00:00
|
|
|
#include <locale.h>
|
2019-11-19 14:10:28 +00:00
|
|
|
#include <unistd.h>
|
2019-11-17 10:04:41 +00:00
|
|
|
#include <stdlib.h>
|
2019-11-17 14:53:59 +00:00
|
|
|
#include <notcurses.h>
|
2019-11-17 10:04:41 +00:00
|
|
|
|
2019-11-21 11:55:05 +00:00
|
|
|
// just fucking around...for now
|
2019-11-17 10:04:41 +00:00
|
|
|
int main(void){
|
2019-11-17 15:25:40 +00:00
|
|
|
struct notcurses* nc;
|
2019-11-19 14:54:14 +00:00
|
|
|
notcurses_options nopts = {
|
|
|
|
.inhibit_alternate_screen = false,
|
|
|
|
.outfd = STDOUT_FILENO,
|
|
|
|
.termtype = NULL,
|
|
|
|
};
|
2019-11-21 11:38:21 +00:00
|
|
|
struct ncplane* ncp;
|
2019-11-21 13:19:57 +00:00
|
|
|
if(!setlocale(LC_ALL, "")){
|
|
|
|
fprintf(stderr, "Couldn't set locale based on user preferences\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2019-11-19 14:54:14 +00:00
|
|
|
if((nc = notcurses_init(&nopts)) == NULL){
|
2019-11-19 11:26:44 +00:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2019-11-21 11:38:21 +00:00
|
|
|
if((ncp = notcurses_stdplane(nc)) == NULL){
|
|
|
|
fprintf(stderr, "Couldn't get standard plane\n");
|
|
|
|
goto err;
|
|
|
|
}
|
2019-11-24 01:39:22 +00:00
|
|
|
sleep(1);
|
2019-11-23 14:05:32 +00:00
|
|
|
int x, y, rows, cols;
|
|
|
|
ncplane_dimyx(ncp, &rows, &cols);
|
|
|
|
cell c;
|
2019-11-24 00:24:29 +00:00
|
|
|
const char* cstr = "✓";
|
|
|
|
cell_load(ncp, &c, cstr);
|
2019-11-23 14:05:32 +00:00
|
|
|
cell_set_fg(&c, 200, 0, 200);
|
|
|
|
for(y = 1 ; y < rows - 1 ; ++y){
|
|
|
|
if(ncplane_cursor_move_yx(ncp, y, 1)){
|
2019-11-21 14:25:17 +00:00
|
|
|
goto err;
|
|
|
|
}
|
2019-11-23 14:05:32 +00:00
|
|
|
for(x = 1 ; x < cols - 1 ; ++x){
|
2019-11-24 00:24:29 +00:00
|
|
|
if(ncplane_putc(ncp, &c, cstr) != (int)strlen(cstr)){
|
2019-11-23 14:05:32 +00:00
|
|
|
goto err;
|
|
|
|
}
|
2019-11-21 13:19:57 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-19 14:10:28 +00:00
|
|
|
if(notcurses_render(nc)){
|
|
|
|
goto err;
|
|
|
|
}
|
2019-11-23 17:28:42 +00:00
|
|
|
sleep(1);
|
2019-11-24 00:24:29 +00:00
|
|
|
const char str[] = " Wovon man nicht sprechen kann, darüber muss man schweigen. ";
|
2019-11-23 23:34:06 +00:00
|
|
|
if(ncplane_cursor_move_yx(ncp, y / 2, (x - strlen(str)) / 2)){
|
2019-11-23 17:28:42 +00:00
|
|
|
goto err;
|
|
|
|
}
|
2019-11-23 17:39:54 +00:00
|
|
|
if(ncplane_fg_rgb8(ncp, 176, 121, 176)){
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
if(ncplane_bg_rgb8(ncp, 255, 255, 255)){
|
2019-11-23 17:28:42 +00:00
|
|
|
goto err;
|
|
|
|
}
|
2019-11-23 23:34:06 +00:00
|
|
|
if(ncplane_putstr(ncp, str) != (int)strlen(str)){
|
2019-11-23 17:28:42 +00:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
if(notcurses_render(nc)){
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
sleep(1);
|
2019-11-17 15:25:40 +00:00
|
|
|
if(notcurses_stop(nc)){
|
2019-11-17 14:53:59 +00:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2019-11-17 10:04:41 +00:00
|
|
|
return EXIT_SUCCESS;
|
2019-11-19 11:44:28 +00:00
|
|
|
|
|
|
|
err:
|
|
|
|
notcurses_stop(nc);
|
|
|
|
return EXIT_FAILURE;
|
2019-11-17 10:04:41 +00:00
|
|
|
}
|