[Scummvm-devel] ENGINE AUTHORS: Please implement Engine::pauseEngineIntern

Max Horn max at quendi.de
Fri May 23 12:39:06 CEST 2008


Dear engine authors,

quite some time ago, we introduce an API in the Engine class for uniformly
(un)pausing an engine. The goal there is to make it possible to pop up
arbitrary dialogs (such as the "Do you really want to quit? (Y/N)" dialog,
or in the future the shared main menu, part of Chris Page's GSoC project)
in all engines, while automatically pausing the engine (including music,
and videos, etc.).

The Engine::pauseEngine(bool pause) method is implemented by class Engine
itself, and you do not have to worry about it. It implements "pause
levels", so if the engine is paused twice, it has to be unpaused twice
before it resumes. That makes life easier, as clients don't have to worry
about correctly stacking pause/unpause requests. Note that Engines can and
should make use of this method, too -- SCUMM, for example, calls
pauseEngine() when it displays its pause dialog.


In order to take advantage of this, engines have to overload the virtual
pauseEngineIntern(bool pause) method. The default implementation in
engines/engine.cpp simply pauses the mixer. In SCUMM, it also pauses MIDI
and records how long the engine was paused, to be able to sync video
playback&audio after unpausing again (BTW, this feature might be useful
for other engines, so maybe it should be moved to class Engine & the
pauseEngine method -- if somebody requests it, that is).


It would be great if this were implemented by all engines. For some, it
should be relatively easy -- for example, for AGOS it should be trivial to
take AGOSEngine::pause() and split out most of the code in there into
pauseEngineIntern(). I attached an example patch that demonstrates what I
mean (though I didn't test it, hence it might be not 100% correct).


As always, if you have any questions, remarks, concerns, tell us!


Cheers,
Max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: agos-pause.patch
Type: text/x-patch
Size: 1429 bytes
Desc: not available
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20080523/efae8a0b/attachment.bin>


More information about the Scummvm-devel mailing list