From: Chris <kc...@st...> - 2004-08-23 09:06:09
|
Evert Glebbeek wrote: > Looks like you're right - although it's possible that the X server keeps > events queued and waits for a retrace, making XSync implicitly wait for > one. Do any of the docs mention this behavior? It's also possible that if XSync waits for the retrace, it may already be passed by the time we get control back. > Anyone agree that the sentence ``this provides a usefule way of controlling > the speed of your program'' should be removed, as it;s usually the first > thing you tell newbies NOT to do (rely on the retrace to control > gamespeed)? Actually, we say not to use vsync or rest to control game speed. Using retrace_count is actually a good idea, IMO, /if/ you can be sure the speed it's running at is suitable for your game logic (ie. you wouldn't want it to be 85 if your logic wants 60). unsigned int cur_tic = retrace_count; while(playing) { while(retrace_count-cur_tic > 0) { logic(); ++cur_tic; } draw(); while(retrace_count == cur_tic) ; } Though for that to work, retrace_count needs to be unsigned. > Also, the second paragraph contains a lot of very old DOS-specific > information, which I guess can be purged by now. I agree. - Kitty Cat |