NSTimer questions
NSTimer questions
- Subject: NSTimer questions
- From: Christoffer Lerno <email@hidden>
- Date: Wed, 22 Sep 2004 14:19:23 +0200
I'm trying to reliably tick a NSTimer to drive animation.
However, on my iBook I notice I occasionally hickups.
Further investigation reveals that if I set a desired fps at 60, I
might have that drop as low as 5 fps at times. (I give you times in fps
because it is simpler that way, 5 fps actually means the delay for that
frame was 0.2 seconds instead of 1/60th of a second which was the
desired delay between firing of the timer.
The actual drawing isn't the problem (I timed that) - it's the timer
which occasionally misses by as much as 200 ms.
I am suspecting that the accuracy of the timer is very dependent on
what's happening in the run loop (like keyboard input and the like).
However I have read that putting the whole thing in a different thread
might be to invite all sorts of pain and suffering.
It would be tempting to move all animation and updates into a separate
thread since it would make the game independent of interaction with
menu-bar and the like. I'm pretty used to running threads in Java with
the synchronizing of methods that entails, but I don't know what I need
to watch out for when working with cocoa.
Is there any way I can do screen updates safely away from the main
thread or what path should I take? I see the load on the computer only
ticks in at less than 10% when running the application, so there should
be plenty to borrow from.
/Christoffer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden