cursor->marked.
This commit is contained in:
		
							parent
							
								
									137bb109d6
								
							
						
					
					
						commit
						79f5a34a06
					
				@ -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:
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user