We are currently building a lot of game prototypes as part of our Ünterplay project at the Media Design department of the HEAD —Genève. A lot of these games require sprites of some sort. So here is a simple demo project showing how to integrate ofxSprite into a basic OpenFrameworks project for iOS. This same technique should also work fine on Mac OS X, Windows and Linux, as the only other dependency is ofxAssets.
Start with a copy of a basic EmptyExample from the OpenFrameworks examples folder
Drag the two new addons into your XCode project. Delete the references to the « README » files if you want to:
- If you encouter problems with the « ofxExtras.h » addon, you can safely de-activate it as in the following illustration:
Copy the « testApp.h » and « testApp.cpp » files from the SpriteDemo.zip example provided here.
Make sure to copy the included « Personnage » folder with the eight PNG images of the sprite. You can obviously replace this image sequence with any sequence of your own, in which case you will need to change line no.24 of « testApp.cpp », using your own file/folder name.
- Compile and run the example.