You have rejected the idea of an interpreted / bytecode compiled language executing on the client instead of sending all low-level commands over the net? It would be like a 3d game language.. Similar to java applet architecture. Of course more work -- guess you need some high-level language implying a compiler, the "emulator" or "virtual machine" in java lingua should be easier to implement. The idea of communicating/animating over the net just does not appeal to me ... even in ten years when "everybody" has 100mbit network there will be lag .. /Olof On 9/5/05, Chris Nystrom <cnystrom@xxxxxxxxx> wrote: > On 9/5/05, Bob Pendleton <bob@xxxxxxxxxxxxx> wrote: > > > > Is the application so busy sending graphics commands that it isn't > > spending time listening to input on the socket? My guess is that you are > > allowing the application to spend all its time sending without receiving > > very often. > > > > No it is multi-threaded, so it is doing both at the same time. I watch the > log file for the application in real time and it seems to get the message > about the event (mouse click or whatever) right away. It is the other end > that seems to be the problem. In an application where there are constant > screen update messages (like an animation that is constantly changing) any > response is buried behind a bunch of previous screen update messages because > of the animation. > > For example, this works fine because it does not re-paint the screen until > something happens: > > -- > > #include "nio_lib.h" > > void paint_screen(void); > bool mouse_state_equal(mouse_state ms_a, mouse_state ms_b); > > static color black; > static mouse_state ms1; > static mouse_state ms2; > static int font; > > int main(int argc, char *argv[]) > { > color white; > > nio_app_init("mouse_test4", "0.1"); > > black = nio_get_color("black"); > white = nio_get_color("white"); > > font = nio_load_sys_font(NIO_DEFAULT_FONT, > NIO_DEFAULT_PTSIZE, > NIO_STYLE_NORMAL, white, > black); > > nio_term_init(font, black, 10, 10, 24, 80); > > ms1 = nio_mouse_state(); > > while (1) { > > ms2 = nio_mouse_state(); > > if (!mouse_state_equal(ms2, ms1)) { > paint_screen(); > } > } > > nio_free_font(font); > nio_exit(); > exit(0); > } > > void > paint_screen(void) > { > nio_clear_screen(black, FALSE); > nio_print_at(2, 2, "\nNIO Mouse Test 4 (version 0.01)\n", > FALSE); > > if (ms2.b1 == PRESSED) { > nio_print_at(6, 2, "MOUSE BUTTON 1 PRESSED", FALSE); > } > > if (ms2.b2 == PRESSED) { > nio_print_at(8, 2, "MOUSE BUTTON 2 PRESSED", FALSE); > } > > if (ms2.b3 == PRESSED) { > nio_free_font(font); > nio_exit(); > exit(0); > } > > nio_printf_at(10, 2, FALSE, "MOUSE X = %d", ms2.x); > nio_printf_at(12, 2, FALSE, "MOUSE Y = %d", ms2.y); > > nio_paint(); > > ms1 = ms2; > } > > bool > mouse_state_equal(mouse_state ms_a, mouse_state ms_b) > { > if (ms_a.b1 != ms_b.b1) > return(FALSE); > > if (ms_a.b2 != ms_b.b2) > return(FALSE); > > if (ms_a.b3 != ms_b.b3) > return(FALSE); > > if (ms_a.x != ms_b.x) > return(FALSE); > > if (ms_a.y != ms_b.y) > return(FALSE); > > return(TRUE); > } > -- > > But there is a noticeable delay with this because it is constantly painting > the screen, and so it works through the backlog of screen messages before it > actually exits if you push the 3rd mouse button: > > -- > > #include "nio_lib.h" > > static color black; > static color white; > static int xi = 1; > static int yi = 450; > static int font_num; > static int image_num; > > void draw_screen(void) > { > nio_clear_screen(black, FALSE); > nio_print_at(0, 0, "\nEXAMPLE 3 version 0.01\n", FALSE); > nio_draw_image(image_num, xi, yi, FALSE); > nio_paint(); > } > > void example3_init(void) > { > black = nio_get_color("black"); > white = nio_get_color("white"); > > font_num = nio_load_sys_font(NIO_DEFAULT_FONT, > NIO_DEFAULT_PTSIZE, > NIO_STYLE_NORMAL, > white, black); > > nio_term_init(font_num, black, 10, 10, 24, 80); > > image_num = nio_load_image("bumper.bmp"); > } > > int main(int argc, char *argv[]) > { > bool fExit = FALSE; > int xinc = 1; > > nio_app_init("example3", "0.1"); > > example3_init(); > > while (!fExit) { > > mouse_state ms; > > draw_screen(); > > ms = nio_mouse_click(); > > if (ms.b1) { > fExit = TRUE; > } > > xi += xinc; > > if (xi > 500) { > xinc = -1; > } > > if (xi < 1) { > xinc = 1; > } > } > > nio_free_image(image_num); > nio_free_font(font_num); > nio_exit(); > exit(0); > } > > Thanks, > > Chris > > -- > E-Mail: Chris Nystrom <cnystrom@xxxxxxxxx> > Business: http://www.shaklee.net/austin > Blog: http://conversazione.blogspot.com/ > AIM: nystromchris --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html