Re: OS X Game Programming
Re: OS X Game Programming
- Subject: Re: OS X Game Programming
- From: Jens Alfke <email@hidden>
- Date: Wed, 7 Apr 2010 09:28:14 -0700
On Apr 7, 2010, at 12:34 AM, Pascal Harris wrote:
I've never programmed games before, although I've got a fair bit of
useful OS X utility software under my belt. I've now had a few
ideas that I'd like to implement - and I'm stuck at almost the first
hurdle. I've managed to create an OpenGL view
For a 2D sprite- or tile-based game, it's easier to work with
CoreAnimation. The API is in Objective-C, is much higher-level, and
does the in-betweening steps of animations for you. Under the hood, CA
uses OpenGL.
I wrote a simple CA-based framework for writing board and card games,
if that's anything like what you're trying to do:
http://bitbucket.org/snej/geekgameboard/
I also started writing an arcade-style game with CA, using the awesome
Box2D physics library. It was quite easy to get shapes acting like
real objects onscreen — towers of boxes falling over, etc. Lots and
lots of iPhone games use Box2D or the similar Chipmunk library for
their physics models. (Of course you could use these with OpenGL too.
They don't care how you draw things, they just tell you where to move
the objects.)
But I can't work out how to get that OpenGL view to accept
keystrokes from my event loop.
NSViews don't accept keyboard focus by default. You need to override -
canBecomeKeyView to return YES, and then wire the view up as the
window's initial key view.
—Jens
_______________________________________________
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