1 #ifndef CURSES_HELPER_HPP 2 #define CURSES_HELPER_HPP 4 #include <ncursesw/ncurses.h> 20 printf(
"\033[?1003l\n");
25 int W = getmaxx(stdscr);
26 int H = getmaxy(stdscr);
27 mvprintw(H-1, W-1-6,
"SIGINT");
40 init_color(COLOR_BLACK, 0, 0, 0);
42 short step =
static_cast<short>(1000 / num_grays);
45 for(
short i=0; i < num_grays; i++)
50 init_color(color_id, i * step, i * step, i * step);
51 init_pair(pair_id, color_id, COLOR_BLACK);
63 attron(COLOR_PAIR(color_pair_id));
64 mvprintw(y, x,
"%lc", sign);
65 attroff(COLOR_PAIR(color_pair_id));
73 short gray_short =
static_cast<short>(gray *
static_cast<float>(
CURSES_NUM_GRAYS) );
79 int W = getmaxx(stdscr);
80 int H = getmaxy(stdscr);
82 for(
int y=0; y<H; y++)
84 for(
int x=0; x<W; x++)
86 wchar_t sign = L
'\u2800';
95 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION,
NULL);
96 printf(
"\033[?1003h\n");
106 keypad(stdscr,
TRUE);
110 nodelay(stdscr,
TRUE);
124 std::locale::global(std::locale(
"en_US.utf8"));
125 std::wcout.imbue(std::locale());
131 return getmaxx(stdscr);
136 return getmaxy(stdscr);
140 #endif // CURSES_HELPER_HPP static short CURSES_NUM_GRAYS
static void console_print_grayscale(int y, int x, wchar_t sign, short gray)
static void set_num_grays(short num_grays)
static mmask_t MOUSE_SCROLL_UP
static void curses_sigint(int sig)
static mmask_t MOUSE_MOVE
static void init_curses(unsigned int num_grayscale)
static short CURSES_CUSTOM_COLORS_SHIFT
static void destroy_curses()
static int curses_width()
static void clear_background()
static int curses_height()
static void init_grayscale(short num_grays)