alec

Abstraction Layer for Escape Codes
git clone git://git.dimitrijedobrota.com/alec.git
Log | Files | Refs | README | LICENSE

demo_runtime.cpp (798B)


      1 #include "alec.hpp"
      2 #include <iostream>
      3 
      4 using namespace alec;
      5 using enum Color;
      6 using enum Decor;
      7 
      8 int main(void) {
      9     std::cout << abuf_enable() << cursor_hide();
     10 
     11     std::cout << cursor_position(1, 1) << foreground(91) << "HELLO!\n";
     12 
     13     std::cout << cursor_down(3);
     14     std::cout << foreground(30) << background(96, 53, 64) << "WORLD!\n";
     15 
     16     std::cout << background(DEFAULT) << "testing 1...\n" << foreground(DEFAULT);
     17     std::cout << decor_set(INVERSE) << "testing 2...\n" << decor_reset(INVERSE);
     18 
     19     std::cout << cursor_up(5) << "Hello there!" << cursor_save();
     20     std::cout << cursor_down(10) << "General Kenobi!";
     21     std::cout << cursor_position(10, 40) << "no pain no gain" << cursor_restore() << cursor_show();
     22 
     23     getchar();
     24 
     25     std::cout << abuf_disable();
     26 
     27     return 0;
     28 }