/* * Copyright (C) Artsiom D. * Copyright (C) shit-co.de */ #include #include #include #include "ui.h" void ui_init(void) { srand(time(NULL)); initscr(); start_color(); init_pair(UI_GREEN, COLOR_GREEN, COLOR_BLACK); init_pair(UI_RED, COLOR_RED, COLOR_BLACK); init_pair(UI_BLUE, COLOR_BLUE, COLOR_BLACK); cbreak(); noecho(); nonl(); intrflush(stdscr, FALSE); keypad(stdscr, TRUE); clear(); refresh(); } void ui_end() { endwin(); } void ui_string(size_t x, size_t y, char *s) { mvaddstr(y, x, s); } void ui_char(size_t x, size_t y, char c) { mvaddch(y, x, c); } void ui_color_on(enum ui_color c) { attron(COLOR_PAIR(c)); } void ui_color_off(enum ui_color c) { attroff(COLOR_PAIR(c)); } void ui_refresh(void) { refresh(); } void ui_clear(void) { clear(); }