Files
cc3k/src/cursor.cc

39 lines
766 B
C++

#include "cursor.h"
#include "constants.h"
cursor::cursor() {
initscr();
}
cursor::~cursor() {
endwin();
}
int cursor::getcmd() const {
return getch();
}
void cursor::show() const {
refresh();
}
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;
}