From 4d7893a26cbddef166757603e4783f6c5f46acb2 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 26 May 2006 19:15:33 +0000 Subject: Switch netgame waiting screen to use the new text mode GUI system. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 534 --- src/net_gui.c | 142 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 79 insertions(+), 63 deletions(-) diff --git a/src/net_gui.c b/src/net_gui.c index e9222d33..7e03d232 100644 --- a/src/net_gui.c +++ b/src/net_gui.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_gui.c 483 2006-05-19 19:57:59Z fraggle $ +// $Id: net_gui.c 534 2006-05-26 19:15:33Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -92,84 +92,96 @@ #include "txt_gui.h" #include "txt_io.h" -static void ProcessEvents(void) +#include "txt_desktop.h" +#include "txt_label.h" +#include "txt_table.h" +#include "txt_window.h" + +static txt_label_t *player_labels[MAXPLAYERS]; +static txt_label_t *ip_labels[MAXPLAYERS]; + +static void EscapePressed(TXT_UNCAST_ARG(widget), void *unused) { - int c; - - while ((c = TXT_GetChar()) > 0) - { - switch (tolower(c)) - { - case 27: - case 'q': - TXT_Shutdown(); - I_Quit(); - break; - - case ' ': - NET_CL_StartGame(); - break; - } - } + TXT_Shutdown(); + I_Quit(); } -#define WINDOW_X 15 -#define WINDOW_Y 5 -#define WINDOW_W 50 -#define WINDOW_H 12 +static void StartGame(TXT_UNCAST_ARG(widget), void *unused) +{ + NET_CL_StartGame(); +} -static void DrawScreen(void) +static void BuildGUI(void) { - char buf[40]; + char buf[50]; + txt_window_t *window; + txt_table_t *table; + txt_window_action_t *cancel; + txt_window_action_t *startgame; int i; + + TXT_SetDesktopTitle(PACKAGE_STRING); + + window = TXT_NewWindow("Waiting for game start..."); + table = TXT_NewTable(3); + TXT_AddWidget(window, table); + TXT_AddWidget(window, NULL); - TXT_DrawDesktopBackground(PACKAGE_STRING); - TXT_DrawWindowFrame("Waiting for game start...", - WINDOW_X, WINDOW_Y, - WINDOW_W, WINDOW_H); + // Add spacers - TXT_BGColor(TXT_COLOR_BLUE, 0); + TXT_AddWidget(table, NULL); + TXT_AddWidget(table, TXT_NewLabel(" ")); + TXT_AddWidget(table, TXT_NewLabel(" ")); + // Player labels + for (i=0; iESC=Abort"); + TXT_SetFGColor(player_labels[i], color); + TXT_SetFGColor(ip_labels[i], color); - if (net_client_controller) - { - TXT_GotoXY(WINDOW_X + WINDOW_W - 18, WINDOW_Y + WINDOW_H - 2); - TXT_Puts("SPACE=Start game"); + if (i < net_clients_in_game) + { + TXT_SetLabel(player_labels[i], net_player_names[i]); + TXT_SetLabel(ip_labels[i], net_player_addresses[i]); + } + else + { + TXT_SetLabel(player_labels[i], ""); + TXT_SetLabel(ip_labels[i], ""); + } } - - TXT_DrawSeparator(WINDOW_X, WINDOW_Y + WINDOW_H - 3, WINDOW_W); - - TXT_UpdateScreen(); } void NET_WaitForStart(void) @@ -178,10 +190,14 @@ void NET_WaitForStart(void) I_SetWindowCaption(); I_SetWindowIcon(); + BuildGUI(); + while (net_waiting_for_start) { - ProcessEvents(); - DrawScreen(); + UpdateGUI(); + + TXT_DispatchEvents(); + TXT_DrawDesktop(); NET_CL_Run(); NET_SV_Run(); -- cgit v1.2.3