[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [paragui-users] ParaGUI and Networking - need advice
From: |
Antony Shaleynikov |
Subject: |
Re: [paragui-users] ParaGUI and Networking - need advice |
Date: |
19 Nov 2003 16:49:39 +0200 |
В Срд, 19.11.2003, в 03:55, leiavoia пишет:
> first of all, glad the project is getting some new attention. please keep up
> the good work. i always keep tabs on this mailing list.
>
> i have a question pehaps someone can answer. My current game project is
> multiplayer. I'd like to implement the networking code with SDL_net, since
> it's compatable and handy. The examples that come with SDL_net all listen for
> incoming data from other computers with a simple while(1) loop. Obviously,
> this is unnacceptable for a GUI application, as the while(1) loop would steal
> from the main ParaGUI/SDL event loop. sooo... is there a way to check a data
> buffer for incoming info (from other computers on the network) on every cycle
> of the event loop without re-writing the pgapplication widget?
>
> The application widget runs the event loop. but is there any way to insert
> things into it's inner workings? It's checks for events and cursor updates
> and visibility and all that. that's nice, but i also need to to listen to
> ports for networking jazz.
>
> Any way to do this without messing with the internals of ParaGUI and without
> making my program all the more complicated by introducing threads (which
> leads to compatability issues)?
>
> thanks for any advice.
>
You can see example in test/dblbuffer.cpp
Use PG_Application.PumpIntoEventQueue(&event) to pump events into your
gui.
while (!done) {
/* Check for events */
++frames;
while ( SDL_PollEvent(&event) ) {
app.PumpIntoEventQueue(&event);
}
........
PG_Widget::BulkBlit();
}
PG_Widget::BulkBlit is a static method, which blits all widgets and
draws cursor.
And do not forget to "SDL_Update" the screen!
--
Software Developer
SW Department, Minsk
Antony Shaleynikov address@hidden