[Scummvm-devel] ATTN porters: updateScreen() OSystem method

Marcus Comstedt marcus at mc.pp.se
Tue Apr 18 03:38:06 CEST 2006

Eugene Sandulenko <sev at scummvm.org> writes:

> Expect updateScreen() to be called at arbitrary rate, say, 200 calls/s.
> Thus if your backend cannot handle that framerate, implement frame skip
> with something like this:
>   updateScreen() {
>       uint32 newTime = _system->getMillis();
>       if (newTime - _oldTime < 1000 / MAX_FPS)
>           return;
>       _oldTime = newTime;
>        // do actual screen update
>   }
> Ideally every backend can implement this, SDL included.
> This is IMHO simple and does not force backend to use some particular
> dirty rect handling, i.e. DC backend can flip whole screen at 60fps.

Yup.  This works, but requires that the engine (or someone else)
actually calls updateScreen on a regular basis.  If it just draws
something and calls updateScreen(), it can't rely on the stuff
actually being displayed.  It needs to keep calling updateScreen()
even if it has nothing more to draw.

Traditionally, this did not always happen, which is why we got "frozen
cursor" bugs in some situations.  IIRC, this thread was about moving
the responsibility for making "null updates" away from the engines so
as to avoid having more bugs of this nature in the future.  Is this
still the plan?

   // Marcus

More information about the Scummvm-devel mailing list