XCode: How to create .app package and work with resources?
I'm very new to OS X and XCode, so please don't assume I know all terminology.
I've been developing my game in Linux for a year. Now I'm moving to OS X with XCode. I saw that in OS X, all the applications, even games, are only one package (ending with a hidden .app
extension if I'm correct). And I want to use that system as well: one single user-friendly .app
package, which can be started by double clicking on it.
I started a new project in XCode using the Command line application
option in the wizard. Is this the correct choice? Or should I've chosen something else to make a .app
application? I've chosen that one because of I'm using SDL, which makes the window automatically.
Now, I finally managed it to make my whol开发者_运维问答e game compile in XCode (using SDL, OpenGL, Box2D), by linking a lot of libraries (SDL.framework
, SDL_image.framework
, libBox2D.dylib
, Cocoa.framework
, OpenGL.framework
).
I want to add resources for my game in the .app
package as well and of course being able to read them.
Question 2: How to work with .app packages in XCode includes resources for my game?
Thanks in advance.
Hopefully, someone can help me out quickly because, tomorrow, I'm going on holiday without internet access.Question 1:
It is a directory. You can examine the contents of a .app bundle via the command line or by using "Show Package Contents" in Finder.
Question 1.5:
You did not want to pick "Command Line Application." You most likely wanted to pick "Cocoa Application" or maybe "Carbon Application." You can read more about the two frameworks at Apple's dev site: http://developer.apple.com
Question 2:
The easiest way is to add your resource files to your Xcode project. There are other ways, but most people don't have to worry about that. In order to read the resource files out of the application bundle, you have to use the NSBundle Objective-C class.
Not asked:
If you use Cocoa, you will have to use Objective-C. Even if you don't, you should learn it anyway if you are going to be writing code for OS X.
精彩评论