Re: Confused about CFRunLoop
Re: Confused about CFRunLoop
- Subject: Re: Confused about CFRunLoop
- From: Brian Greenstone <email@hidden>
- Date: Mon, 17 Mar 2008 22:26:29 -0500
I was using NSTimer originally, but I was having the exact same
problem since NSTimer is really just a CFRunLoopTimerRef according to
the docs. As far as I can tell, using NS calls to do this is just a
more complicated way than simply calling CF directly to do it without
all that Obj-C gibberish.
That being said, I'm really not trying to do anything funky. I'm just
trying to setup a Timer that will fire at 60 times/second to call my
game's main loop. Each time it fires, the passes thru the game's main
loop once. When the game is done, I exit the loop to return to the
game's menu or high-scores screen. The logic worked great with those
old Carbon calls, and everything is actually working now with these CF
run loop calls too, it's just that I'm not getting mouse or keyboard
events when I enter the loop. They're being blocked. So, the big
question is really: how do I enter a CF run loop and keep getting
keyboard and mouse events?
Thanks!
-Brian
On Mar 17, 2008, at 10:10 PM, Jeff LaMarche wrote:
Brian:
Welcome to Cocoa. It's a different, different approach than the old
Toolbox or Carbon stuff.
Is there a reason that NSTimer wouldn't work for you? I know you
work primarily in games (I lost many hours to Xenocide back in the
day, and a few other of your creations as well), so maybe NSTimer
can't do what you need, but it's quite unusual to manually create a
run loop in Cocoa. Your application main method launches the main
thread's run loop, and when you create new threads, they get a run
loop automatically as well.
Maybe if you explain a little more about what you need the timer to
do, I could offer a better suggestion.
Sorry I'm not more help,
Jeff
__________________________________________________________
Brian Greenstone
President & CEO email@hidden
Pangea Software, Inc. http://www.pangeasoft.net
12405 John Simpson Ct. voice/fax: (512)266-9991
Austin, TX 78732
__________________________________________________________
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden