Fixed screen flicker on cursor movement.

This commit is contained in:
Murilo Pereira 2011-05-31 03:31:36 -03:00
parent 1c63b767f6
commit ae5ccc75cb
2 changed files with 7 additions and 4 deletions

View File

@ -19,7 +19,7 @@ void allocate_cursor(struct cursor **cursor) {
} }
void initialize_cursor(struct cursor *cursor) { void initialize_cursor(struct cursor *cursor) {
cursor->window = newwin(0, 0, cursor->y, cursor->x); cursor->window = newwin(1, 1, cursor->y, cursor->x);
cursor->x = CURSOR_BEGIN_X; cursor->x = CURSOR_BEGIN_X;
cursor->y = CURSOR_BEGIN_Y; cursor->y = CURSOR_BEGIN_Y;
cursor->marked = false; cursor->marked = false;

View File

@ -145,13 +145,16 @@ void draw_deck(struct deck *deck) {
void draw_cursor(struct cursor *cursor) { void draw_cursor(struct cursor *cursor) {
if (cursor->marked) { if (cursor->marked) {
mvwaddch(cursor->window, cursor->y, cursor->x, '@'); mvwin(cursor->window, cursor->y, cursor->x);
waddch(cursor->window, '@');
} else { } else {
mvwaddch(cursor->window, cursor->y, cursor->x, '*'); mvwin(cursor->window, cursor->y, cursor->x);
waddch(cursor->window, '*');
} }
wrefresh(cursor->window); wrefresh(cursor->window);
} }
void erase_cursor(struct cursor *cursor) { void erase_cursor(struct cursor *cursor) {
mvwdelch(cursor->window, cursor->y, cursor->x); wdelch(cursor->window);
wrefresh(cursor->window);
} }