From: Peep P. <so...@us...> - 2004-08-03 14:49:22
|
Update of /cvsroot/agd/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1282 Modified Files: main.c Log Message: Removed gui stuff. Index: main.c =================================================================== RCS file: /cvsroot/agd/client/main.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- main.c 9 Jan 2004 20:52:06 -0000 1.1.1.1 +++ main.c 3 Aug 2004 14:49:12 -0000 1.2 @@ -1,12 +1,12 @@ #include <allegro.h> +#include <stdio.h> #include "agi.h" #include "gui.h" -#include "stdio.h" -#define VERSION "vDev" +#include "sys.h" BITMAP *buffer; static int update; -gui_window_t *welcome; +gui_window_t *login; void gfx_init(void) { @@ -25,42 +25,83 @@ printf("agipix: %d;%d\n", agipix_w, agipix_h); } -void welcome_ok_cb(void) +void login_connect_cb(void) { - welcome->visible = 0; + login->visible = 0; update = 1; - printf("click\n"); } -gui_window_t *make_welcome(void) +void login_cancel_cb(void) +{ + exit(0); +} + +gui_window_t *make_login(void) { gui_window_t *win; - gui_button_t *okbut; - gui_label_t *label; + gui_textbox_t *port_tb; - win = gui_new_window(200, 150, 200, 100, GUI_WP_CLOSE); - win->title = "AGD client"; + win = gui_new_window(200, 55, 200, 175, GUI_WP_CLOSE); + win->title = "Connect to server"; - okbut = gui_new_button(25, 15, "OK", welcome_ok_cb); - gui_add_widget(win, okbut, GUI_SWT_BUTTON, 90, 132); - label = gui_new_label(180, 50, "Welcome!\nThis is an early version of the AGD client. Nothing works yet.\nStay tuned.\n\n\tsolicit"); - gui_add_widget(win, label, GUI_SWT_LABEL, 10, 10); + gui_add_widget(win, gui_new_button(25, 15, "Connect", login_connect_cb), + GUI_SWT_BUTTON, 100, 35); + gui_add_widget(win, gui_new_button(25, 15, "Cancel", login_cancel_cb), + GUI_SWT_BUTTON, 60, 35); + + gui_add_widget(win, gui_new_label(50, 15, "Hostname:"), + GUI_SWT_LABEL, 5, 5); + gui_add_widget(win, gui_new_label(50, 15, "Port:"), + GUI_SWT_LABEL, 5, 20); + port_tb = gui_new_textbox(75, 12); + port_tb->value = "6868"; + gui_add_widget(win, port_tb, GUI_SWT_TEXTBOX, 60, 18); return win; } -int main(int argc, char **argv) +int main(int argc, char *argv[]) { - + if(argc > 1) { + if(argc > 2) + conf.port = atoi(argv[2]); + else + conf.port = NET_DEFAULT_PORT; + conf.host = argv[1]; + } + + if(!conf.host || !conf.port) { + printf("Syntax: %s <server hostname> [port]\n", argv[0]); + exit(1); + } + + net_connect(); + gfx_init(); + show_mouse(NULL); + clear_to_color(buffer, AGI_BLACK); gui_init(); + + while(!key[KEY_ESC]) { +/* blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);*/ + + net_events(); +/* blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);*/ +#if 0 + gui_draw(); + gui_events(); +#endif + } + +#if 0 + login = make_login(); - welcome = make_welcome(); update = 1; while(!key[KEY_ESC]) { if(update) { clear_to_color(buffer, AGI_CYAN); - gui_draw_window(buffer, welcome); +/* gui_draw(buffer);*/ + gui_draw_window(buffer, login); show_mouse(NULL); blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); @@ -68,9 +109,13 @@ update = 0; } - if(welcome->visible) - gui_events(welcome); + +/* gui_events();*/ + if(login->visible) + gui_events(login); } +#endif + return 0; } END_OF_MAIN() |