diff options
| -rw-r--r-- | doc/uidesign.txt | 10 | ||||
| -rw-r--r-- | src/display.c | 10 | ||||
| -rw-r--r-- | src/display.h | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/doc/uidesign.txt b/doc/uidesign.txt index 8662c07..2db66ae 100644 --- a/doc/uidesign.txt +++ b/doc/uidesign.txt @@ -30,11 +30,13 @@ Hand Cards: The player's hand cards sorted in ascending order Table Cards: Four card stacks growing from right to left, showing the uppermost/highest card Stack Points: For each table card stack it shows the sum of points of all cards on the stack + +== Things that are to do == +TODO: Sort table every round by lowest cards after players selected/revealed the cards +TODO: Player Hints: Will be used to tell the players whose player's turn it is. The player himself will be instructed what is to do (play a hand card and then possibly pick a stack from table) + DONE: Use colored borders/numbers/stars to distinguish cards and for a nicer UI look. DONE: A selected card and a selected stack should be displayed as bold text. DONE: Display revealed cards next to nicks after all players have chosen their cards. DONE: Table captions will be printed bold. -Sort table every round by lowest cards after players selected/revealed the cards -Highlight current player (who is choosing a stack) by inverting its line. - -Player Hints: Will be used to tell the players whose player's turn it is. The player himself will be instructed what is to do (play a hand card and then possibly pick a stack from table) +DONE: Highlight current player (who is choosing a stack) by coloring its line. diff --git a/src/display.c b/src/display.c index 7772732..2ca3a5c 100644 --- a/src/display.c +++ b/src/display.c @@ -158,7 +158,7 @@ void display_window_stack_points(const tablestacks ts) * @param[in] num_players The number of players to show a player name and open card for * @param[in] score The players score */ -void display_window_current_state(const player_name_open_card_tuple pnoc[], const uint8_t num_players, const uint32_t score) +void display_window_current_state(const player_name_open_card_tuple pnoc[], const uint8_t num_players, const uint8_t active_player, const uint32_t score) { wattron(w_current_state, A_BOLD); mvwprintw(w_current_state, 0, 0, "Current state:"); @@ -170,6 +170,9 @@ void display_window_current_state(const player_name_open_card_tuple pnoc[], cons for (uint8_t i = 0; i < num_players; i++) { + if (i == active_player) + wattron(w_current_state, COLOR_PAIR(CP_YELLOW_ON_BLACK)); + if (i < 5) { mvwprintw(w_current_state, 2+i, 1, "%-s", pnoc[i].player_name); @@ -180,6 +183,9 @@ void display_window_current_state(const player_name_open_card_tuple pnoc[], cons mvwprintw(w_current_state, 2+(i-5), 22, "%-s", pnoc[i].player_name); mvwprintw(w_current_state, 2+(i-5), 34, "%3d", pnoc[i].open_card); } + + if (i == active_player) + wattroff(w_current_state, COLOR_PAIR(CP_YELLOW_ON_BLACK)); } wrefresh(w_current_state); @@ -273,7 +279,7 @@ void display_init(void) refresh(); display_window_table_cards(ts, true, 1); display_window_stack_points(ts); - display_window_current_state(pnoc, num_players, score); + display_window_current_state(pnoc, num_players, 2, score); display_window_hand_cards(h, true, 8); sleep(4); diff --git a/src/display.h b/src/display.h index 8cfb217..5f31a63 100644 --- a/src/display.h +++ b/src/display.h @@ -10,7 +10,7 @@ void display_window_table_cards(const tablestacks ts, const bool highlight, const uint8_t highlighted_stack); void display_window_stack_points(const tablestacks ts); -void display_window_current_state(const player_name_open_card_tuple pnoc[], const uint8_t num_players, const uint32_t score); +void display_window_current_state(const player_name_open_card_tuple pnoc[], const uint8_t num_players, const uint8_t active_player, const uint32_t score); void display_window_hand_cards(const hand h, const bool highlight, const uint8_t highlighted_card); void display_init(void); void display_fini(void); |
