2D Graphics wih Objective-C

Member
Posts: 312
Joined: 2006.10
Post: #1
Hey, to get comfortable with Objective-C I was intending on writing a 2D side-scroller platform game. I'm not sure which API to use. Should I go straight Cocoa, OpenGL, Quartz 2D, or maybe some other API like SDL (if it can be used with objective-c?). Which of these is best suited for 2D game programming?
Quote this message in a reply
Moderator
Posts: 3,570
Joined: 2003.06
Post: #2
Cocoa with OpenGL is a great combination, having all the speed and Obj-C goodness you could ask for! The only possible drawback (if you can consider it that) is that you'll also have to pick up a bit of OpenGL, if you don't already know some of it, which can be tricky for the uninitiated.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #3
If you use OpenGL, speed will probably not be a concern for a 2D side-scroller. If you use something which renders via software with no hardware acceleration, it probably will be. Not to say it can't be made to work, but you'll want to be prepared to optimize quite a bit, whereas you'd get the speed more or less for free with OpenGL.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #4
An Xcode template if you want to go with cocoa and opengl:
http://fax.twilightcoders.net/files/Coco...cation.zip

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #5
Thanks! I was thinking OpenGL. I'm not very familiar with it though. I dabbled in it for a little while, but never put much into it. There are the great tutorials at Deep Cocoa also ^_^

How much of a challenge would it be to learn a sufficient amount of OpenGL to use it for a 2D game?

Edit - Btw, Unknown, the template won't open because the project file can't be parsed.... :/
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #6
you dont open it, it goes in the folder with other xcode templates. Then you choose New Cocoa OpenGL Application and one is created based on the template.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #7
Oh, duh! I thought you mean it as a template, not as a "xcode template". Sorry
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #8
Deep Cocoa tutorials are rubbish, don't go there.
Quote this message in a reply
Moderator
Posts: 3,570
Joined: 2003.06
Post: #9
OneSadCookie Wrote:Deep Cocoa tutorials are rubbish, don't go there.
I'm not so sure I'd throw rocks like that in our little glass house! There aren't many other options outside of NeHe for decent Cocoa/GL tutorials, and even those leave plenty of room for improvement. Wink
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
Better no tutorials than ones that are as wrong as the Deep Cocoa ones are Rasp

Not a tutorial, but this may be useful: http://onesadcookie.com/book
Quote this message in a reply
Moderator
Posts: 3,570
Joined: 2003.06
Post: #11
OneSadCookie Wrote:Better no tutorials than ones that are as wrong as the Deep Cocoa ones are Rasp
You can put the rock down now. Rasp
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #12
AnotherJake Wrote:I'm not so sure I'd throw rocks like that in our little glass house! There aren't many other options outside of NeHe for decent Cocoa/GL tutorials, and even those leave plenty of room for improvement. Wink

Im not sure what your analogy is supposed to mean...... but really there is no need for tutorials, just a look at some working code (That gets an OpenGL context set up inside an NSView), and learn OpenGL seperatley from Cocoa.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 3,570
Joined: 2003.06
Post: #13
unknown Wrote:Im not sure what your analogy is supposed to mean......
That's probably because you haven't heard the old saying: People who live in glass houses should not throw rocks.

The need for tutorials has absolutely zero to do with [*why* I said] what I said.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #14
Yeah of course I know the saying, I just dont see why you are saying it.. anyway it doesnt matter.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #15
Why are they considered poor? Bad coding styles? Or other reasons?
Quote this message in a reply
Post Reply