From ffef04a78f6985e9fcff5454a608de24bd25388e Mon Sep 17 00:00:00 2001 From: Mario Kilies Date: Tue, 25 Jan 2011 14:03:48 +0100 Subject: Implemented the message window. --- src/ui.c | 18 +++++++++++++++++- src/ui.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui.c b/src/ui.c index 661219a..f64fe21 100644 --- a/src/ui.c +++ b/src/ui.c @@ -21,6 +21,7 @@ static bool colors = false; static WINDOW *w_table_cards; static WINDOW *w_stack_points; static WINDOW *w_current_state; +static WINDOW *w_messages; static WINDOW *w_hand_cards; static void draw_card(WINDOW *w, const uint8_t row, const uint8_t col, const bool highlight, const card c) @@ -260,6 +261,19 @@ void ui_display_wnd_current_state(const player_list_t *pl, const uint8_t num_pla wrefresh(w_current_state); } +/** + * Displays the message window. + * @param[in] message The message to display +*/ +void ui_display_wnd_messages(const char *message) +{ + wclear(w_messages); + + mvwprintw(w_messages, 0, 0, "%s", message); + + wrefresh(w_messages); +} + /** * Displays the hand cards window. * @param[in] h The hand that will be displayed. h must be sorted in ascending order @@ -443,7 +457,8 @@ void ui_init(void) // Window positions and sizes w_table_cards = newwin(21, 15, 0, 0); w_stack_points = newwin(19, 4, 0, 17); - w_current_state = newwin(10, 38, 0, 24); + w_current_state = newwin(8, 38, 0, 24); + w_messages = newwin(2, 39, 7, 24); w_hand_cards = newwin(11, 39, 10, 24); // Set input settings for windows @@ -463,6 +478,7 @@ void ui_fini(void) delwin(w_table_cards); delwin(w_stack_points); delwin(w_current_state); + delwin(w_messages); delwin(w_hand_cards); endwin(); // End curses mode } diff --git a/src/ui.h b/src/ui.h index 048aca6..4532ab3 100644 --- a/src/ui.h +++ b/src/ui.h @@ -10,6 +10,7 @@ void ui_display_wnd_table_cards(const table_stacks_t *ts, const bool highlight, const uint8_t highlighted_stack); void ui_display_wnd_stack_points(const table_stacks_t *ts, const bool highlight, const uint8_t highlighted_points); void ui_display_wnd_current_state(const player_list_t *pl, const uint8_t num_players, const bool highlight, const uint8_t highlighted_player, const uint32_t score); +void ui_display_wnd_messages(const char *message); void ui_display_wnd_hand_cards(const hand_t *h, const bool highlight, const uint8_t highlighted_card); uint8_t ui_choose_card(hand_t *h); uint8_t ui_choose_stack(const table_stacks_t *ts); -- cgit v1.2.3