Writing Propane Injector Applications for Apple Xcode

Last updated September 02, 2006

Get the library

Download the latest version of the source from the Propane Injector website.

Make a new project

Get the SDL libraries

Go to the SDL website, and install the SDL runtime and development packages for Mac OS X. Also install the SDL_image and SDL_mixer runtime and development packages.

Runtime installation

Drag the frameworks to a framework directory as per the instructions from the DMGs. Remember where you put them.

Development installation

Follow the instructions for installing the development kits, and make sure you install the Xcode templates for SDL and OpenGL projects.

Get started

Open Xcode and create a new SDL and OpenGL project. If you don't see this, you installed the Xcode templates improperly from the SDL development package.

Now add the SDL_image and SDL_mixer frameworks to your project, and drop the Propane Injector 'engine' folder into your Xcode project, and tell it to copy the files to the destination folder and to create new groups.

(If necessary) set the Project options to look inside the SDL_image, SDL and SDL_mixer frameworks for headers (Header Search Paths). Consult the SDL site for further details on this.

Make sure to remove the atlantis/ folder and items from the project, but keep SDLmain.m and SDLmain.h intact.

Create your program

Write a simple main() function calling Propane::initSDL and Propane::initGL. Include "engine/PropaneInjector.h". Then compile and run the program.

If everything went well, the program should compile, link, run, flick up a window, and then close down.

This is the framework of your Propane Injector app! Now go wild adding sprites, animation, and sound.

Troubleshooting

Include file location errors

Change your header search paths in the Xcode project options to reflect the internal headers of the frameworks for SDL, SDL_image and SDL_mixer.

Link errors

Make sure the SDL, SDL_image and SDL_mixer frameworks are part of the project, as well as OpenGL and GLU.

Make sure that the entire PI engine folder is added to the project and accessible (no red files).

If all else fails, try to specify frameworks manually using the -framework switch to the linker options in the project settings.

Redefinition of main

Make sure there are no test files sitting in the PI directory, and that you have removed the atlantis example files.