Xcode templates for the Sparrow Framework

August 11th, 2010 Leave a comment Go to comments

Sparrow is a library which enables you to develop OpenGL iPhone / iPad applications without the need of using the OpenGL framework itself. It is written completely in Objective-C so you don’t have to struggle with the C language. However if you want to you can still use both in combination with Sparrow.

For more information about the Sparrow Framework please visit their website.

Logo Sparrow FrameworkWhen you want to use the Sparrow framework you need to download the package and do quite a number of manual steps before you can get started. It involves copying a existing project, renaming it, change some parameters etc…

If you create several applications or if you want to create several test projects this can be quite cumbersome. I’ve taken the effort to create Xcode templates which handles this for you, all you need to do is create a new project and everything is setup automatically.

Download & Installation

The download and installation has been changed completely, in the old days you needed to download several files and extract them yourself. Now we just have a single installer which will install the file and project templates for you. Just download the following package and run it. Upon choosing the installation location make sure you select the Macintosh HD as the installation destination.

Sparrow Templates Installer Package (363)

Installation

Installing the Sparrow Framework:

Installation is fairly straight forward, first you need to download the Sparrow Framework library itself. This is needed since the actual Sparrow Framework library code is not included within the project template. Reason for this is when a new version of Sparrow is released you can easily upgrade your projects by changing only a single setting.

To download the Sparrow Framework visit their site.

Extract the archive to your own preferred location. Now in Xcode open the Xcode preferences and select the Source Trees tab.

Xcode Sparrow Framework Source Folder

Click for a larger image

Create a new entry with the following information:

Setting Name: SPARROW_SRC, Display Name: SPARROW_SRC, Path: Point this to the Sparrow source path. (extracted location/Sparrow_v0.9/sparrow/src)

When you install a newer version of Xcode in the default location or in a separate location there is no need to change this, all Xcode installations look in the same location for user templates.

Now everything is installed.

How to get started

First you need to create a new project, from Xcode select the File -> New -> Project option. In the window that appears is a new section called User Templates -> Sparrow Framework, when you select this you will see the projects that you can create. Select the project you want to create and click on Choose… now create the project as you would normally create a project (enter a name etc..)

Xcode new Sparrow Project

Click for a larger image

When you are done you should see something similar to the following:

Xcode Sparrow Project

Click for a larger image

To test if everything is setup correctly select the correct simulator version (by default it sometimes select a device version) and select the Build & Run option. If everything is setup correctly you will see the iPhone simulator running your project:

iPhone Simulator: Sparrow Project

Click for a larger image

When you want to create a new Scene simply choose File -> New File, here there will also be a new section called User Templates -> Sparrow Framework. Here are all the file templates which have been installed. (the number of templates and the naming of the templates can be different for various versions)

Xcode new Sparrow Scene

Click for a larger image

Version Information

Version 1.3

Compatible with Sparrow Version 0.9

Changed installation method to using an Installer instead of extracting and installing it yourself.

Added iOS4 Compatibility for multitasking (as described in de Blog: Multitasking )

Changed base SDK and default deployment target to iOS4.

Added project templates for iPad and universal binary for iPhone/iPad development.

Version 1.2

Bugfix: missing Other linker flag (project preferences) -all_load

iOS4 Compatible (Simulator and Device has been tested)

Version 1.1

Compatible with Sparrow Version 0.8

Changed Scene File template to SPSprite template (on request by the authors of Sparrow)

Version 1.0

Compatible with Sparrow Version 0.7

iPhone Xcode project template including integration with the Sparrow Framework

Scene File template

Roadmap

As you might have noticed, the project template is only setup for use with an iPhone, i still need to adjust the project so that it also directly supports the iPad. Also i would like to create more file templates so that it even can help you more in your daily work.

  1. Henrik Holm
    June 28th, 2010 at 14:06 | #1

    Hi

    I just found Sparrow and it looks really interesting. Months ago I tried looking at Cocos2d but I never got the hang of it.

    And I would really appreciate the creation of more file templates.

    Great work.

    Thanks

  2. June 29th, 2010 at 18:45 | #2

    Do you have any specific requests for certain file templates or just templates that can help you since you just started using Sparrow? I am creating my own project using Sparrow and i hope by doing that i can see certain recurring patterns that i can translate to template files which can benefit everybody. However, i am also working on a standard iPhone project that currently consumes most of my time. So if you have any requests that could help to speed things up a bit.

  3. Henrik Holm
    July 4th, 2010 at 13:58 | #3

    No requests in particular.

    As you noticed I myself just started using this framework so I have nothing yet. Literally just seconds ago I got the Demo project working.

  4. paul
    July 7th, 2010 at 12:02 | #4

    Thanks for the templates but something isn’t right. That path specified for template locations doesn’t exist in my root library but does exist in my root/Developer/Library path. Is that where the templates should go? The file template shows up but my project template does not! Ideas?

    Cheers!

  5. July 7th, 2010 at 12:22 | #5

    It is possible that the path doesn’t exist after installing XCode, in this case you need to create the path manually.

  6. Paul Georges
    July 7th, 2010 at 16:40 | #6

    It’s alright I finally fixed up. Is it possible that the templates were not set up for iOS4 coding? Is it possible that the latest install installs in /Developer with its own Library pah contrarily to previous SDKS? This is just a guess, this is the first time I’ve started coding for iPhone. Also, in the project template the paths to the iPhone SDK libraries are not found correctly :(

  7. July 9th, 2010 at 05:15 | #7

    They should work fine with iOS4 since i updated to the latest version of Sparrow which is also compatible with iOS4. What you might need to do is check your project preferences and see if the correct versions of the SDK are selected.

    The paths of where to install the templates haven’t changed in the latest version of XCode (and the previous). I don’t now if you use the preview version of XCode (which was only supplied to people attending the WWDC converence) because i don’t have that version yet. (it cannot be downloaded from the iPhone developer portal, not even as a beta).

  8. July 11th, 2010 at 15:01 | #8

    I installed your templets and … thanks for doing this BTW but I am having a bit of an issue and I think it more to do with the current version of sparrow than your templets because I got the same issue when trying to run the demo when downloading he framework.

    It seems that the current projects demo and templet try to point to frameworks in the iphone 3.0 SDK. I am running the latest SDK ios 4. Please see a couple of screen shots I took of the issue.

    http://grab.by/5mSz
    http://grab.by/5mSB

    Now the question is … how do I fix ? I tried going to the project settings and changing it to use iphone 4. That didn’t help. It says that iphone 3.0 sdk is missing. Naturally because I did a fresh install of the developer tools and it does not come with 3.0. I only have 3.2, 3.2 and 4.0

    thanks,
    Matthew

  9. July 12th, 2010 at 07:05 | #9

    I need to check this, but i cannot do this at the moment but in the evening i can check it for you. (localtime: +1 GMT)

  10. Henry Cooke
    July 19th, 2010 at 13:15 | #10

    Thanks for making these templates! I too have had some trouble with the locations, which I’ve now fixed. Can I suggest that you recommend that users place them in ~/Library/Application Support/Developer/Shared/Xcode (e.g under their home directory)? This makes them independent of a specific XCode install, which is handy if you have both a beta and mainstream version installed (as I do). Also, it should be pointed out that the project template only works if it’s placed in a subfolder of Project Templates e.g Project Templates/Sparrow Application/.

    Cheers,
    Henry

  11. July 19th, 2010 at 15:41 | #11

    What is unclear about the paths? because i have re-read the explanation and they point out to that location.

    There are two parts that need to be installed, sparrow itself, which can be any location that you prefer (since you use a link in your Source Trees and the other, the file templates are as explained in the location as you mention.

    I now have updated the page to explicitly say that there are TWO different installation parts. I think a lot of people mix-up the installation paths of the Sparrow project with those of the Template projects.

    Finally, the subfolders you mention are also mentioned in the text and also in the pictures.

  12. Henry Cooke
    July 20th, 2010 at 01:12 | #12

    Hm. It wasn’t clear to me that the contents of Sparrow-0.8-Project-Template_1.2.zip should live in a subfolder (which I named “Sparrow Application”) of “Project Templates” in order to appear in XCode’s New Project window. Looking at the image again, I guess the information’s there. Maybe I just didn’t get it the first time.

    Also, I still think ~/Library (e.g the in the user’s home) is a better place for them than /Library. I guess that’s a matter of personal taste though ;)

  13. July 20th, 2010 at 08:49 | #13

    @ Henry Cooke

    Now i understand what you mean with the user’s home folder. The behavior you describe with the user home folder is the same as the behavior for the location i specify in the description above. Installing the templates in that location makes it available for all XCode installations on your Mac too.

    I didn’t know XCode would also look into your home folder to see if there are extra templates installed.

    And about the Project Templates folder, that is displayed in the image but i’ll also change the text so it reflects that more clearly.

  14. July 28th, 2010 at 20:16 | #14

    Hi Ronald,

    Thanks for the helpful templates. They work fine in the emulator, but the red box is missing on my iPhone. The one thing is that my iPhone has 4.0.1 on it, which is probably the snake in the grass.

    I tried Xcode 4 Preview 2, but could not get the templates to show up, so the library location may not work. I followed your screenshot above, but no luck.

    Thanks anyways,
    Jacobus

  15. July 29th, 2010 at 05:22 | #15

    @ Jacobus
    Are you recieving any compilation / runtime errors? If you start the application from Xcode to run on the device, so not selecting the icon on your home screen but setting the target to be your device and click on the run button in your Xcode do you see any errors in your console view?

  16. August 8th, 2010 at 00:46 | #16

    Sorry, I also had trouble understanding how to install the templates correctly. The file structure in the image and the folders from the downloads don’t match up.

    For anyone that is stuck: the Project Templates will self-extract as a folder called “Sparrow Based Application”. You must put this in a folder called “Sparrow Framework”, then put that folder in /Library/Application Support/Developer/Shared/Xcode/Project Templates/

    The File Templates self-extract as a folder called “Sparrow Framework” and can be placed straight into /Library/Application Support/Developer/Shared/Xcode/File Templates/

    Thank you for the templates=)

  1. June 1st, 2010 at 09:04 | #1
  2. June 1st, 2010 at 19:31 | #2
Did you know that it is also possible to register as a user? this enables you to create comments without constantly specifying your name, e-mail and captcha code. Register