Re: Need Win Guru/Tester
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 14, 2003
- 471 views
On Mon, 13 Jan 2003 16:51:01 -0600, "C. K. Lester" <cklester at yahoo.com> wrote: >Pete! Thanks so much! No prob. You owe me a favour or two by now though ;) He he >How would you resolve this, however: the loop uses done, but then it = exits >if done is true inside the actual looping code. What I'm thinking is = that it >can be optimized or done differently so there aren't two tests for done = in >the same loop code. > >while done=3D0 do -- here's done > SDL_PumpEvents() > if done then exit end if -- here's done Personally I probably wouldn't bother. I don't know -er anything- about the SDL_ processing innards. When you resort to using an external library (including windows dll files which I use) the overheads of a few local lines are zip compared to just one unnecessary call. The only hints I have come from recent use of win32lib's doEvents(0). It took me an embarrassing while to realise this, but any flags etc I could check could _only_ have been altered as an indirect consequence of that call. I could write 20GB of data to disk, calculate PI to a trillion decimal places, and no other line of my code could *possibly* have been executed, hence none of my flags changed until just after calling doEvents(0). Guess where I put my tests. I also found it quite prohibitively expensive to start calling doEvents(0) too often. At one point I introduced a counter to basically draw 100 things between each call to doEvents(0)/check for termination condition. The routine itself is not at fault; it's not especially slow; but it is utterly pointless to call it more that 25 times a second. The human eye, mice, keyboards, joysticks, etc do not respond any (or much) faster than that. SDL_PumpEvents() may or may not be similar to doEvents(). I didn't realise the name similarity when I last posted. Pete