You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
5 years ago
|
#include <cstdio>
|
||
|
#include <cstdlib>
|
||
|
#include <clocale>
|
||
|
#include <cassert>
|
||
5 years ago
|
#include <memory>
|
||
5 years ago
|
#include <unistd.h>
|
||
5 years ago
|
#include <ncpp/NotCurses.hh>
|
||
|
|
||
|
using namespace ncpp;
|
||
5 years ago
|
|
||
4 years ago
|
auto main() -> int {
|
||
5 years ago
|
setlocale(LC_ALL, "");
|
||
4 years ago
|
notcurses_options nopts{};
|
||
4 years ago
|
nopts.flags = NCOPTION_INHIBIT_SETLOCALE | NCOPTION_NO_ALTERNATE_SCREEN;
|
||
4 years ago
|
NotCurses nc(nopts);
|
||
4 years ago
|
{
|
||
|
std::unique_ptr<Plane> n (nc.get_stdplane());
|
||
|
int dimx, dimy;
|
||
|
nc.get_term_dim(&dimy, &dimx);
|
||
5 years ago
|
|
||
4 years ago
|
const int HEIGHT = 5;
|
||
|
const int WIDTH = 20;
|
||
|
auto na = std::make_unique<Plane>(n.get(), HEIGHT, WIDTH,
|
||
|
dimy - (HEIGHT + 1),
|
||
|
NCAlign::Center);
|
||
|
uint64_t channels = 0;
|
||
|
if(!na){
|
||
|
goto err;
|
||
|
}
|
||
4 years ago
|
n->set_fg_rgb(0x00ff00);
|
||
|
na->set_fg_rgb(0x00ff00);
|
||
4 years ago
|
if(!na->cursor_move(0, 0)){
|
||
|
goto err;
|
||
|
}
|
||
|
if(!na->rounded_box_sized(0, channels, HEIGHT, WIDTH, 0)){
|
||
|
goto err;
|
||
|
}
|
||
|
if(n->printf(0, 0, "arrrrp?") < 0){
|
||
|
goto err;
|
||
|
}
|
||
|
if(!n->rounded_box_sized(4, channels, HEIGHT, WIDTH, 0)){
|
||
|
goto err;
|
||
|
}
|
||
|
if(!nc.render()){
|
||
|
goto err;
|
||
|
}
|
||
5 years ago
|
}
|
||
|
sleep(1);
|
||
4 years ago
|
return nc.stop() ? EXIT_SUCCESS : EXIT_FAILURE;
|
||
5 years ago
|
|
||
|
err:
|
||
|
return EXIT_FAILURE;
|
||
|
}
|