Sign in to follow this  
cNoob

OS-X Development Basics

Recommended Posts

cNoob    295
So I'm new to developing on a mac I have Xcode setup and I've tested several example projects and everything seems to be going fine, I've been reading about the several options I have. Im planning on using the OpenGL API aswell as leaning over more towards cocoa than carbon. The only thing I'm unsure of is objective-c, I know I could just forget about it and use the SDL library for window management. What are your takes on the native OS-X API's and what other options do I have?

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Original post by cNoob
So I'm new to developing on a mac I have Xcode setup and I've tested several example projects and everything seems to be going fine, I've been reading about the several options I have. Im planning on using the OpenGL API aswell as leaning over more towards cocoa than carbon. The only thing I'm unsure of is objective-c, I know I could just forget about it and use the SDL library for window management.

What are your takes on the native OS-X API's and what other options do I have?
My own preference is to work with cross-platform languages/APIs (C++/Boost/OpenGL/SDL or C#/OpenGL/SDL). This way, you can target (e.g.) Windows and Linux as well.

Share this post


Link to post
Share on other sites
daviangel    604
Quote:
Original post by jyk
Quote:
Original post by cNoob
So I'm new to developing on a mac I have Xcode setup and I've tested several example projects and everything seems to be going fine, I've been reading about the several options I have. Im planning on using the OpenGL API aswell as leaning over more towards cocoa than carbon. The only thing I'm unsure of is objective-c, I know I could just forget about it and use the SDL library for window management.

What are your takes on the native OS-X API's and what other options do I have?
My own preference is to work with cross-platform languages/APIs (C++/Boost/OpenGL/SDL or C#/OpenGL/SDL). This way, you can target (e.g.) Windows and Linux as well.

I also stick with Allegro/SDL on my Mac and have yet to find a good reason to have to learn YAPL.

Share this post


Link to post
Share on other sites
superpig    1825
Good call on not going with Carbon; Cocoa "Is The Future," I've been told.

Objective-C really isn't that horrible to work with. It's mostly just C, you just have to use these strange constructs every once in a while if you want to communicate with things like the Cocoa API. You can mutate it upwards into Objective-C++ if you want to.

Share this post


Link to post
Share on other sites
daviangel    604
Quote:
Original post by superpig
Good call on not going with Carbon; Cocoa "Is The Future," I've been told.

Objective-C really isn't that horrible to work with. It's mostly just C, you just have to use these strange constructs every once in a while if you want to communicate with things like the Cocoa API. You can mutate it upwards into Objective-C++ if you want to.

Yup the next version of Photoshop is only going to be 64bit for Windows since the Adobe photoshop developers need to learn Objective-C first. So Objective-C must be different enough from standard C that they couldn't get the next version of photoshop out for the Mac since the previous versions were Cabon based from what I understand. Kinda lame that Apple stopped supporting Carbon though but from I remember reading a while back the Objective-C developers forced Apple's hand since the majority of Apple developers use it and they told Apple if it wasn't kept as the primary language they would defect to Windows,Linux,etc.
At least I remember reading about an uproar a while back about Apple thinking of dropping Objective-C or maybe it was Steve Jobs himself?
I dunno I'm not really an Apple fanatic to know about it?

As we wrapped up Photoshop CS3, our plan was to ship 64-bit versions of the next version of Photoshop for both Mac and Windows. On the Mac Photoshop (like the rest of the Creative Suite, not to mention applications like Apple's Final Cut Pro and iTunes) relies on Apple's Carbon technology. Apple's OS team was busy enabling a 64-bit version of Carbon, a prerequisite for letting Carbon-based apps run 64-bit-native.

At the WWDC show last June, however, Adobe & other developers learned that Apple had decided to stop their Carbon 64 efforts. This means that 64-bit Mac apps need to be written to use Cocoa (as Lightroom is) instead of Carbon. This means that we'll need to rewrite large parts of Photoshop and its plug-ins (potentially affecting over a million lines of code) to move it from Carbon to Cocoa.



[Edited by - daviangel on May 15, 2008 1:01:59 AM]

Share this post


Link to post
Share on other sites
superpig    1825
Quote:
Original post by daviangel
Yup the next version of Photoshop is only going to be 64bit for Windows since the Adobe photoshop developers need to learn Objective-C first. So Objective-C must be different enough from standard C that they couldn't get the next version of photoshop out for the Mac
That's a bit surprising. If you've got an application written in C or C++, the only parts where you need to use any Objective-C is in the layer where you interface with the system and UI...

Quote:
since the previous versions were Cabon based from what I understand.
Ahh, right. Yeah, that's going to be more of a problem; they're probably taking time out to rewrite their Mac layer then. Porting from Carbon to Cocoa is almost as significant as porting from Windows to Mac in the first place.

Share this post


Link to post
Share on other sites
cNoob    295
I'm actually pretty surprised with the objective-c syntax, last night, looking at example code It just didn't look like I would be able to get along with it. Today I read a few articles, at first I thought it might take a while but after sticking with it for a few hours, everything started to make sense.

From what I understand, when creating a cocoa Xcode project, in the main.m file there is a call to the NSApplicationMain function. For now I've just been commenting that out and using a console window to display my test applications output. With that line uncommented it looks like it's loading the main.nib file, creating the window and any controls. I'm assuming most mac game developers would just edit the main.nib file in the interface builder, adding an OpenGL view control?

I still havn't touched the interface builder yet but I'm Just curious, is it possible to create and setup a window from code without having to use the interface builder, if so, what are the advantages/disadvantages of using this method over using the Interface Bulder other than It's quicker to use the IB =]

Also, if I was to use the IB to add an OpenGL view control to the window, how would I interact with that object instance and have it continuesly render while the game loop is still alive?

Share this post


Link to post
Share on other sites
superpig    1825
Quote:
Original post by cNoob
I'm assuming most mac game developers would just edit the main.nib file in the interface builder, adding an OpenGL view control?
Yes, or some subclass of the view control.

Quote:
I still havn't touched the interface builder yet but I'm Just curious, is it possible to create and setup a window from code without having to use the interface builder, if so, what are the advantages/disadvantages of using this method over using the Interface Bulder other than It's quicker to use the IB =]
Yes, probably - I'm not aware of any advantages, unless you're doing something like Minesweeper and want to create each individual cell as a different button.

Quote:
Also, if I was to use the IB to add an OpenGL view control to the window, how would I interact with that object instance and have it continuesly render while the game loop is still alive?
Read.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this