From 79f5a34a060662b4f540d2a78428d1ec520aa43b Mon Sep 17 00:00:00 2001 From: Murilo Pereira Date: Tue, 31 May 2011 02:42:10 -0300 Subject: [PATCH] cursor->marked. --- lib/cursor.c | 9 +++++++++ lib/cursor.h | 3 +++ lib/display.c | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/cursor.c b/lib/cursor.c index 77e0817..1e682d6 100644 --- a/lib/cursor.c +++ b/lib/cursor.c @@ -22,6 +22,7 @@ void initialize_cursor(struct cursor *cursor) { cursor->window = newwin(0, 0, cursor->y, cursor->x); cursor->x = CURSOR_BEGIN_X; cursor->y = CURSOR_BEGIN_Y; + cursor->marked = false; } void free_cursor(struct cursor *cursor) { @@ -31,6 +32,14 @@ void free_cursor(struct cursor *cursor) { free(cursor); } +void mark_cursor(struct cursor *cursor) { + cursor->marked = true; +} + +void unmark_cursor(struct cursor *cursor) { + cursor->marked = false; +} + void move_cursor(struct cursor *cursor, enum movement movement) { switch (movement) { case LEFT: diff --git a/lib/cursor.h b/lib/cursor.h index ecea910..ba357fe 100644 --- a/lib/cursor.h +++ b/lib/cursor.h @@ -28,6 +28,7 @@ struct cursor { WINDOW *window; int x; int y; + bool marked; }; enum movement { LEFT, DOWN, UP, RIGHT }; @@ -37,6 +38,8 @@ extern struct deck *deck; void allocate_cursor(struct cursor **); void initialize_cursor(struct cursor *); void free_cursor(struct cursor *); +void mark_cursor(struct cursor *); +void unmark_cursor(struct cursor *); void move_cursor(struct cursor *, enum movement); #endif diff --git a/lib/display.c b/lib/display.c index 41a50e3..b11cb61 100644 --- a/lib/display.c +++ b/lib/display.c @@ -144,7 +144,11 @@ void draw_deck(struct deck *deck) { } void draw_cursor(struct cursor *cursor) { - mvwaddch(cursor->window, cursor->y, cursor->x, '*'); + if (cursor->marked) { + mvwaddch(cursor->window, cursor->y, cursor->x, '@'); + } else { + mvwaddch(cursor->window, cursor->y, cursor->x, '*'); + } wrefresh(cursor->window); }