[Scummvm-devel] Timer system change proposal
Max Horn
max at quendi.de
Tue Aug 13 17:19:07 CEST 2002
Could we change the current timer system so that the timer proc gets
an additional parameter: void *refCon
The idea is that when you install a timer, you can pass along a void
pointer, which in turn can point to any sort of data (or be typecast
to an int). Then this pointer is simply passed to the timer whenever
it is invoked. Implementing this in the default timer code is
trivial, and after looking at the morphos timer I believe it could be
added there, too.
Why? Because it would allow us to get rid of a few global variables
(or at least get rid of some of their uses) which currently the
timers have to use because they have no other way to get to these
global objects (like g_scumm). If we had refCon, you could just pass
in that data and the timer callback could cast it to the right format.
This is a common technique, I don't see any problems introducing it,
but various benefits for it.
Getting rid of g_scumm is one of my mid term goals :-)
Max (who right now is thinking about a GameEngin class which would
become superclass of Scumm and SimonState and unify the interfaces to
those two classes)
--
-----------------------------------------------
Max Horn
Software Developer
email: <mailto:max at quendi.de>
phone: (+49) 6151-494890
More information about the Scummvm-devel
mailing list