#include "cursor.h" #include "constants.h" cursor::cursor() { initscr(); if (has_colors()) { start_color(); init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK); init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK); init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK); init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK); init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK); init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK); init_pair(COLOR_BLACK_ON_WHITE, COLOR_BLACK, COLOR_WHITE); } } cursor::~cursor() { endwin(); } int cursor::getcmd() const { return getch(); } void cursor::show() const { refresh(); } void cursor::clear() const { } void cursor::print_char(const position &pos, const char ch, const int attrs) const { attrset(attrs); mvaddch(pos.y, pos.x, ch); } void cursor::print_str(const position &pos, const std::string str, const int attrs) const { attrset(attrs); mvaddstr(pos.y, pos.x, str.c_str()); } bool check_terminal_size() { int max_x; int max_y; getmaxyx(stdscr, max_y, max_x); return max_x >= DISPLAY_WIDTH && max_y >= DISPLAY_HEIGHT; }