Re: Confused about CFRunLoop
Re: Confused about CFRunLoop
- Subject: Re: Confused about CFRunLoop
- From: Brian Greenstone <email@hidden>
- Date: Mon, 17 Mar 2008 23:01:22 -0500
Cocoa is really only necessary for GUI based apps, but I'm doing games
which are almost 99.9% custom code with no Mac OS X GUI. Ergo, I
really don't have any need for Cocoa other than the basic window and
OpenGL initialization. After that I just use Core Foundation for
everything else. Like I say, tho, according to the docs, a CF run
loop is the same exact thing as an NS run loop. It's just a matter of
if you prefer calling a C function or an Obj-C class. They both do
the same thing, and both act like modal run loops when I start them.
Both block any user input, so there's no way to use menu's or controls
in any windows. This has nothing to do with Cocoa vs. C or whatever
since they both do the exact same thing.
I know that there is a way to do what I want to do because I've read
that RunApplicationEventLoop() is just CFRunLoopRun() with some extra
work on top of it to make it run non-modally. So, what I just need to
figure out is what RunApplicationEventLoop() is doing to do that. I
doubt it's anything magical, it's probably just some additional
combination of CF calls, but I can't figure out what those calls are :(
Oh well...
Thanks,
-Brian
On Mar 17, 2008, at 10:52 PM, Kyle Sluder wrote:
I really can't find a better way to say this, so here it goes: the
"Obj-C gibberish" you refer to is an entire object-oriented platform,
and is *the* canonical way to develop applications for OS X. It seems
you don't fully understand what Cocoa is, and that might be the root
of your problems. As MC Lars would say, "I hate to say it, but
welcome to the future." This is cocoa-dev after all.
That said, for what you're doing, you would not create a run loop and
run it yourself. Creating a new run loop will, as you surmised, send
yourself into what amounts to a modal loop. Events (mouse, keyboard,
ink, Apple Events...) come in from the window server and get queued in
some input that's attached to the main thread's run loop. If you're
spinning in your own run loop, your main run loop will never get the
opportunity to process and dispatch those events. So you will need to
create a timer (NSTimer or CFRunLoopTimerRef) and schedule it on the
existing run loop in the modes you need.
__________________________________________________________
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