[C++] API sync + some (breaking) changes
Added: * Plane: gradient (`ncplane_gradient`) * Plane: gradient_sized (`ncplane_gradient_sized`) * NotCurses: drop_planes (`ncplane_drop_planes`) * NcReel: constructor which takes `Plane&` * Visual: constructors which take `Plane const*`, `Plane&` and `Plane const&`) * ncpp_build: a nonsensical "demo" which exists purely to test whether the C++ builds and does absolutely nothing interesting. Broke: * All exceptions throw temporary objects instead of allocated instances. Less typing in `catch` :P (and more conventional)pull/354/head
parent
f08d51c5e7
commit
e429724287
@ -0,0 +1,57 @@
|
||||
//
|
||||
// This is a **build** test - it does nothing else except ensure that all the C++ wrapper classes are included and that
|
||||
// the program builds.
|
||||
//
|
||||
// Once there are demos which exercise all the C++ classes this "test" can be removed
|
||||
//
|
||||
#include <cstdlib>
|
||||
#include <clocale>
|
||||
#include <iostream>
|
||||
#include <ncpp/NotCurses.hh>
|
||||
#include <ncpp/Menu.hh>
|
||||
#include <ncpp/Plane.hh>
|
||||
#include <ncpp/Reel.hh>
|
||||
#include <ncpp/Selector.hh>
|
||||
#include <ncpp/Visual.hh>
|
||||
#include <ncpp/Direct.hh>
|
||||
|
||||
using namespace ncpp;
|
||||
|
||||
int run ()
|
||||
{
|
||||
NotCurses nc;
|
||||
|
||||
const char *ncver = nc.version ();
|
||||
Plane plane (1, 1, 0, 0);
|
||||
|
||||
nc.stop ();
|
||||
|
||||
Direct direct (getenv ("TERM"));
|
||||
direct.set_fg (0xb5, 0x0d, 0xff);
|
||||
std::cout << "notcurses version: ";
|
||||
direct.set_bg (0x05, 0x6e, 0xee);
|
||||
direct.set_fg (0xe2, 0xbf, 0x00);
|
||||
std::cout << ncver << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
if (!setlocale (LC_ALL, "")){
|
||||
std::cerr << "Couldn't set locale based on user preferences" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
try {
|
||||
return run ();
|
||||
} catch (ncpp::init_error &e) {
|
||||
std::cerr << "Initialization error: " << e.what () << std::endl;
|
||||
} catch (ncpp::invalid_state_error &e) {
|
||||
std::cerr << "Invalid state error: " << e.what () << std::endl;
|
||||
} catch (ncpp::invalid_argument &e) {
|
||||
std::cerr << "Invalid argument error: " << e.what () << std::endl;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue