iDevGames Forums
XCode, App and Data files - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: XCode, App and Data files (/thread-799.html)



XCode, App and Data files - xiotex - Aug 30, 2009 11:56 AM

So, I have been building my game on the Mac using XCode, SDL and OpenGL for a while now and I am actually in danger of completing one. It suddenly occurs to me that I don't actually know how to package one up. By that I mean how do I get the final App package to contain the data and get the App to read from it. Up till now I have set the absolute path. Any help/tips on this will be helpful!


XCode, App and Data files - SethWillits - Aug 30, 2009 12:11 PM

Dump your assets folder into your Xcode project. Use "Create Folder References...". Xcode will copy that folder into the Resources directory of the application package (YourGame.app/Contents/Resources/YourAssetsFolder). Then you could reference it relative to the current working directory (or change the directory) which can be done with plain C, or you could use a Cocoa method to get at the Resources folder path and use that, or SDL might have something to get at the Resources path as well (I'm not sure).


XCode, App and Data files - xiotex - Aug 30, 2009 12:21 PM

I have a copy of XCode 3 unleashed that I have been working through in order to solve this little issue and your one little post cut through all that like a hot knife through butter. Thanks!


XCode, App and Data files - backslash - Aug 30, 2009 12:46 PM

I don't trust XCode to include my resources on its own - it tends not to notice when they change. For that reason I use a custom build phase to run rsync to copy my resources into the bundle for me.
Code:
rsync -r [i]ProjectFolder/Resources AppBundlePath/Contents/Resources[/i]



XCode, App and Data files - wyrmmage - Aug 30, 2009 02:31 PM

Are you using any .dylibs? If so, there may be some special requirements.


XCode, App and Data files - xiotex - Aug 30, 2009 03:29 PM

I am using one dylib and have setup the DYLD_LIBRARY_PATH variable to point at the library concerned. Took a bit of digging to find that one too.