From 8ab568a6a9f3a1f20e1aa7c8b8a5554acd1cdcf4 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 9 Mar 2018 21:01:11 +0100 Subject: [PATCH] Multiplayer: use table header widgets for column headers. --- data/language/en-GB.txt | 8 ++++---- src/openrct2-ui/windows/Multiplayer.cpp | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index b1732f5875..83cca96b99 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3832,8 +3832,8 @@ STR_5492 :Scenario options STR_5493 :Send Message STR_5494 : STR_5495 :Player List -STR_5496 :Player: -STR_5497 :Ping: +STR_5496 :Player +STR_5497 :Ping STR_5498 :Server List STR_5499 :Player Name: STR_5500 :Add Server @@ -3978,7 +3978,7 @@ STR_5638 :Permission denied STR_5639 :{SMALLFONT}{BLACK}Show list of players STR_5640 :{SMALLFONT}{BLACK}Manage groups STR_5641 :Default Group: -STR_5642 :Group: +STR_5642 :Group STR_5643 :Add Group STR_5644 :Remove Group STR_5645 :Chat @@ -4006,7 +4006,7 @@ STR_5666 :Passwordless Login STR_5701 :{WINDOW_COLOUR_2}Last action: {BLACK}{STRINGID} STR_5702 :{SMALLFONT}{BLACK}Locate player's most recent action STR_5703 :Can't kick the host -STR_5704 :Last Action: +STR_5704 :Last Action STR_5705 :Can't set to this group STR_5706 :Can't remove group that players belong to STR_5707 :This group cannot be modified diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 482116b476..80e7dc775b 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -41,7 +41,11 @@ enum WINDOW_MULTIPLAYER_WIDGET_IDX { WIDX_TAB3, WIDX_TAB4, - WIDX_LIST = 8, + WIDX_HEADER_PLAYER = 8, + WIDX_HEADER_GROUP, + WIDX_HEADER_LAST_ACTION, + WIDX_HEADER_PING, + WIDX_LIST, WIDX_DEFAULT_GROUP = 8, WIDX_DEFAULT_GROUP_DROPDOWN, @@ -74,6 +78,10 @@ static rct_widget window_multiplayer_information_widgets[] = { static rct_widget window_multiplayer_players_widgets[] = { MAIN_MULTIPLAYER_WIDGETS, + { WWT_TABLE_HEADER, 0, 3, 175, 46, 60, STR_PLAYER, STR_NONE }, // Player name + { WWT_TABLE_HEADER, 0, 176, 258, 46, 60, STR_GROUP, STR_NONE }, // Player name + { WWT_TABLE_HEADER, 0, 259, 358, 46, 60, STR_LAST_ACTION, STR_NONE }, // Player name + { WWT_TABLE_HEADER, 0, 359, 400, 46, 60, STR_PING, STR_NONE }, // Player name { WWT_SCROLL, 1, 3, 336, 60, 236, SCROLL_VERTICAL, STR_NONE }, // list { WIDGETS_END } }; @@ -509,6 +517,8 @@ static void window_multiplayer_players_resize(rct_window *w) w->no_list_items = network_get_num_players(); w->list_item_positions[0] = 0; + w->widgets[WIDX_HEADER_PING].right = w->width - 5; + w->selected_list_item = -1; window_invalidate(w); } @@ -581,12 +591,6 @@ static void window_multiplayer_players_paint(rct_window *w, rct_drawpixelinfo *d window_draw_widgets(w, dpi); window_multiplayer_draw_tab_images(w, dpi); - // Columns - gfx_draw_string_left(dpi, STR_PLAYER, nullptr, w->colours[2], w->x + 6, 58 - 12 + w->y + 1); - gfx_draw_string_left(dpi, STR_GROUP, nullptr, w->colours[2], w->x + 180, 58 - 12 + w->y + 1); - gfx_draw_string_left(dpi, STR_LAST_ACTION, nullptr, w->colours[2], w->x + 263, 58 - 12 + w->y + 1); - gfx_draw_string_left(dpi, STR_PING, nullptr, w->colours[2], w->x + 363, 58 - 12 + w->y + 1); - // Number of players stringId = w->no_list_items == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL; x = w->x + 4;