Project Resistance: Day 1

Screenshot showing initial version of Project Resistance running on the iPhoneToday I did some of the preliminary work for Project Resistance. For the most part today was about setting up some infrastructure for the application, setting up source code repositories, file layouts and the like.

Creating a GitHub account

For this project I’ve decided to host the source code on GitHub. This seemed a more “iPhone” friendly location than Codeplex and gives me an excuse to try out Git. A distributed source code system I have not used before.

After signing up for a free account and following their instructions on creating an SSH key-pair to help verify my identity I was ready to create a new project repository by answering a few questions (such as name and homepage URL).

Since I don’t have Git installed on my machine I next downloaded and installed it via the Git OSX Installer. Once installed I needed to perform a small amount of configuration from the terminal.

git config --global "Christopher Fairbairn"
git config --global

With this out of the way I was ready to create a local git repository.

Creating a git repository

To create a new repository you simply create a new directory in a convenient location and execute the “git init” command within it.

mkdir Project-Resistance
cd Project-Resistance
git init

One benefit of a distributed source control system is that I can work against this local reposistory, committing changes and even branching the project without needing to be connected to a centralised server. This could come in handy as I tend to work in a number of environments without decent connectivity.

To test out git I decided to create a short README file that describes the purpose of the project. Once I had created the file in a text editor I needed to make git aware of it, and then finally commit the change to the repository with a short explanation of what I had done.

git add README
git commit -m 'added README file'

With all the changes committed locally, it was time to perform the really big smoke test and push the changes I had made up to the repository stored on github. I could achieve this by performing the following two commands from a terminal window.

git remote add origin
git push origin master

Stubbing out a project

Within XCode I created a new iPhone application by selecting the Tab Bar Application project template. I then added some of the graphic files as resources.

Unlike the Windows Mobile application which required a small amount of plumbing code to be developed in order to draw images with alpha transparency I was simply able to drag and drop the images onto my view within Interface Builder. The Cocoa Touch framework supports controls with transparency out of the box.

Within a couple of minutes I was displaying the alpha blended images within the iPhone Simulator.

Day 1 Summary

Today was relatively straight forward. The process to create a git repository on github was rather quick, and now that I have the git utility installed I could even have started the project without internet connectivity.

Likewise by using the Tab Bar Application project template within XCode I was able to get the main screen of the application looking pretty good without writing a single line of source code.

Luckily I was able to reuse many of the graphical assets commissioned by Chris Tacke on his first day, although eventually I’ll need to replace these to cope with the iPhone’s different screen resolution (480×320). Currently I’m stretching them. It will be interesting to see how Chris handles this situation himself, as the screen resolution and orientation of Windows Mobile devices can vary significantly.

Leave a Reply