[SDL] Timer & graphics functions (was: Re: [SDL] SDL_Quit() and timers...)

user at domain.invalid user at domain.invalid
Fri Aug 10 20:36:01 PDT 2001


Standa Opichal wrote:

> Well, what are the other methods. If you have an emulator and want to make
> e.g. 200Hz timer. You must blit the screen at 50Hz frequency.
> What is the SDL like (multiplatform) solution for this problems?

What I did in my emulator was to use the number of emulated clock cycles 
to determine when the video refresh should occur and do the refresh in 
the emulator's thread after the appropriate number of clock cycles has 
ellapsed.  As long as your emulator adjusts itself to maintain the 
correct clock speed of the emulated system, you get a fairly reliable 
way to do your screen updates.  It isn't the main thread of the 
application, but it is the only thread doing updates to the SDL window. 
  I don't know how portable this is but it seems to be working on 
Windows and Linux - YMMV.

Marc







More information about the SDL mailing list