Timer support

hi, i am currently doing some development on the MAC, os 9.x. I have been
trying to setup a timer callback, but get an error that multiple timers are
not supported on this platform. i’m not too sure what exactly this means.
is there a way to set things up to use the SDL_AddTimer???

–Keith

hi, i am currently doing some development on the MAC, os 9.x. I have
been trying to setup a timer callback, but get an error that multiple
timers are not supported on this platform. i’m not too sure what
exactly this means.

There’s no multithreading support on MacOS classic.

is there a way to set things up to use the
SDL_AddTimer???

Not that I know off - but I’m not a Mac programmer.

AFAIK, it would have to be implemented in a completely different way,
compared to other platforms; abusing the audio callback or something.
(Without threads, you’ll need something that can call your timer handlers
from interrupt context, like the audio subsystem does.)

Either way, regardless of platform, you’re usually better off using
"virtual timing", rather than actual timer callbacks. It’s much simpler
to do properly, and is often more solid, and usually more efficient.

What I mean by “virtual timing” is some other way of doing it than
actively forcing the game logic (or whatever) to run every N ms. Check
the current time (SDL_GetTicks()) before rendering each video frame, and
"fast forward" the game logic to the corresponding time before you render
the frame.

Either use a fixed “logic frame rate” for the game logic and advance the
required number of logic frames for each video frame (possibly
interpolating between the last two sets of world coordinates, like I do
in Kobo Deluxe), or scale all movements, speeds, accelerations etc by the
delta time. (I personally don’t like the latter method because of the
complexity involved in getting it totally independent of the video
frame rate. Scaling speed and acceleration may sound trivial, but wait
until you get to the collision detection part… :slight_smile:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Thursday 23 May 2002 14:43, Keith Swyer wrote: