What Caught Our Eye This Week – July 26 to August 1, 2009

Aug 2, 2009   //   by Derek van Vliet   //   Weekly Recap  //  No Comments

Here’s a look at just some of the things that we kept our eye on this week:

  • Why nobody hates software more than software developers. Hint: it’s because we know the volumes of bad code that get poured into it.
  • Google Voice applications got rejected from the iPhone’s App Store. This is causing a lot of concern among both developers and users of the iPhone platform. Michael Arrington even declared that he’s “quitting” the iPhone.
  • Two researchers announced they had discovered a way to virally infect and hijack the functions of every iPhone on earth. Thankfully, none of Get Set Games’ devices were affected once they unveiled the exploit on Thursday. Apple was quick to release a patch.
  • In a bid to keep iPhone jailbreaking illegal, Apple claimed in a filing that jailbreaking would turn the iPhone into a weapon against cell-phone towers.
  • We watched in amazement as Yahoo! committed seppuku this week, making it a historic week in online search.

If you’d like to keep track of what we read and join in on the discussion, join our FriendFeed room.

5 Ways to Take Screenshots of Your iPhone App

Jul 30, 2009   //   by Derek van Vliet   //   Development  //  16 Comments

Screenshots are an integral tool in application development, not to mention marketing. You may find you need a screenshot in any number of situations. Here are 5 ways you can capture a screenshot of your iPhone app. Each one is useful in a different way.

Do It With OS X

The first method is good old screen capture that is built into OS X. This is, of course, not exclusive to iPhone apps. You can hold down Command-Shift-3 to save a screenshot to your desktop in PNG format. This is useful for if you want to take a screenshot while you are running your app in the emulator.

Even more useful, in my opinion, is the Command-Shift-4 function. This turns your cursor into cross-hairs and lets you select a region of the screen to save as your screenshot, again as a PNG. This is great if you just wanted to grab a portion of your app.

You can also add Ctrl to both of the above keyboard shortcuts to save the screenshot to your clipboard instead of to disk. Then you can go paste the screenshot into Photoshop or some other image editor.

Do It With Grab

Grab is an application that comes with OS X which you can find in your Applications/Utilities folder. It features the unique ability to take a screenshot of a window:


This means if you run your app in the iPhone Simulator and then use Grab, you can take screenshots of your app looking all hot in the actual device with just a couple of clicks. This is a great way to get shots of your app in the iPhone if you don’t own one or aren’t a paid developer. Here’s the result:


Screenshots that come out of Grab are in TIFF format.

Do It With Xcode

Xcode’s Organizer tool provides a simple interface for taking screenshots of whatever is currently displaying on an iPhone that is connected to your computer. Open it by going to Xcode’s Window menu and selecting Organizer or just hit Ctrl-Command-O.


Once it is opened, select your iPhone from the Devices section on the left. Then go to the Screenshot tab in the main section. Now use your application on the iPhone until it is in a state where you want to take a screenshot. Finally, press the capture button in Organizer and boom: you’re done.

Xcode saves screenshots as PNG files in the following folder on your machine:

~/Library/Application Support/Developer/Shared/Xcode/Screenshots/

Do It With the iPhone

Did you know you can take a screenshot of anything that the iPhone is doing at any time? It’s true. Just press and hold the home button. While you’re holding it, press and release the Sleep/Wake button. The iPhone’s screen will flash and the camera shutter sound will play. The screenshot will have been saved to your camera roll, which you can access in the Camera app or the Photos app.


Do It With Code

Finally, you can capture screenshots at precise moments in your application by using the following pair of objective-c methods. The first one, captureView, returns a UIImage that contains a render of any UIView (except EAGLView, see below). If you pass your app’s UIWindow into this method, it will return you a screenshot of the app.

The second method, saveScreenshotToPhotosAlbum, takes it a step further and saves an image that contains a render of any UIView to your iPhone’s photo album.

- (UIImage*)captureView:(UIView *)view {
	CGRect rect = [[UIScreen mainScreen] bounds];
	CGContextRef context = UIGraphicsGetCurrentContext();
	[view.layer renderInContext:context];
	UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
	return img;
- (void)saveScreenshotToPhotosAlbum:(UIView *)view {
	UIImageWriteToSavedPhotosAlbum([self captureView:view], nil, nil, nil);

Since the above 2 methods don’t work for EAGLView, we need another solution. Below are a pair of methods that do the equivalent of the above 2 for apps using EAGLView, courtesy iPhone Dev SDK Forum.

- (UIImage*) getGLScreenshot {
    NSInteger myDataLength = 320 * 480 * 4;
    // allocate array and read pixels into it.
    GLubyte *buffer = (GLubyte *) malloc(myDataLength);
    glReadPixels(0, 0, 320, 480, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
    // gl renders "upside down" so swap top to bottom into new array.
    // there's gotta be a better way, but this works.
    GLubyte *buffer2 = (GLubyte *) malloc(myDataLength);
    for(int y = 0; y <480; y++)
        for(int x = 0; x <320 * 4; x++)
            buffer2[(479 - y) * 320 * 4 + x] = buffer[y * 4 * 320 + x];
    // make data provider with data.
    CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, buffer2, myDataLength, NULL);
    // prep the ingredients
    int bitsPerComponent = 8;
    int bitsPerPixel = 32;
    int bytesPerRow = 4 * 320;
    CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
    CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
    CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;
    // make the cgimage
    CGImageRef imageRef = CGImageCreate(320, 480, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent);
    // then make the uiimage from that
    UIImage *myImage = [UIImage imageWithCGImage:imageRef];
    return myImage;
- (void)saveGLScreenshotToPhotosAlbum {
	UIImageWriteToSavedPhotosAlbum([self getGLScreenshot], nil, nil, nil);

A Look at Our iPhone Game in its Infancy

Jul 29, 2009   //   by Derek van Vliet   //   Development  //  No Comments

Here’s a quick look at the current state of our iPhone game in action. We just got animated sprites working (thanks to cocos2d) so still images are no longer going to be enough to illustrate its sheer awesomeness.

This video was taken with another iPhone, of course.

cocos2d for iPhone Xcode Project Template

Jul 24, 2009   //   by Derek van Vliet   //   Development  //  4 Comments

Wouldn’t it be nice if you could fire up Xcode and create a new cocos2d iPhone project using the New Project wizard? Thanks to these instructions, you can do just that. This was easily the most useful thing I came across today.

The following assumes you have git installed, which you can download here.

Determine your Xcode root directory. For example, I have Xcode for iPhone OS 2.0 in /Developer and Xcode for iPhone OS 3.0 in /Developer3.0

To set up this project template, add it to: /Developer3.0/Library/Xcode/Project Templates/Other by creating a sub-directory there, and then, from within the sub-directory, get the code with:

git clone git://github.com/tjweir/cocos2d-application.git

If you haven’t already, get the latest cocos2d tarball from http://www.cocos2d-iphone.org/download and untar it.

Under the global Xcode preferences, add (or update if it already exists) a Source Tree called COCOS2D_SRC. Make it point to the top-most cocos2d directory, like /Developer/Library/cocos2d-iphone-0.8-beta/

You should now be able to create a new cocos2d project from this template (it should be somewhere at the bottom of the list when you go to File -> New Project).

Static linking is awesome.

It sure is! Here’s the end result:


iPhone Development First Impressions

Jul 23, 2009   //   by Derek van Vliet   //   Development  //  No Comments

Get Set Games' First iPhone Game, Running on the iPhone

After about 20 hours, we went from very little knowledge of the iPhone platform to a pretty impressive prototype running on the device (as seen above). Now I’m taking stock of how exactly that happened.

I’m not only new to iPhone development, but also to Mac development. Xcode is completely new to me and so is Objective-C. Until now I have mainly developed on Windows using Visual Studio or web apps on IIS/LAMP servers.

I have to say I am really impressed that an IDE the quality of Xcode is included in the price of the Mac hardware. It is a solid tool. That being said, I have been spoiled with IntelliSense in VS. Xcode’s CodeSense just doesn’t match up. Auto-complete is good, but it isn’t quite enough.

Compared to other object-oriented languages, the differences of Objective-C are only skin-deep. The syntax took some getting used to. I mainly had problems with access issues of class member variables and methods. But being able to switch between that and standard C syntax is a life-saver.

We have chosen cocos2d for iPhone as our game engine. It is well documented, well supported by an active community and the price is right (read: it’s open source). It makes it very easy to set up a game structure: menu screen, game loop, frame-rate independent logic. The plethora of sample projects that they distribute give you examples of just about any functionality you could want in a 2D game. Our decision to use cocos2d was, in my opinion, the prime reason why we were able to get so much running so soon.

On the whole, at this early stage, I am very impressed with the iPhone development experience. The learning curve was not as steep as others have made it out to be. The device performs better than I expected it to under stress tests. The communities (both cocos2d and the Apple iPhone Developer communities) are active and enthusiastic. At this point I couldn’t be more pleased with our prospects.

Dev Sprint – July 19

Jul 23, 2009   //   by Rob Segal   //   Development  //  4 Comments

The Cocos bean, at least I think its a bean.

Due to the fact that we all have day jobs getting the time to work on our project is the biggest limiting factor to getting it done.  With time being extremely valuable  we have been brainstorming various ways that we can make a good chunk of progess.

What we came up with was evening, one day and weekend long dev sprints.  So far we’ve only being doing one day and evening sprints and the results have been pretty tremendous.   The sprints consist of the artists “arting” and the coders “coding” till everyone is fed up to do anything else.

There are several advantages to doing code sprints where everyone is on the same site.

  1. You are less inclined to be distracted on some other task or start playing games because there is someone there with you.
  2. You have a bunch of people you can easily bounce ideas off of.

Think of a LAN party but for coding/designing/creating.  It’s the formula we’ve used for many successful TO Jam games like our most recent creation Flock U.

On this particular day me and Derek were taking our first in depth look at the Cocos2D game engine.  A free open source engine for developing games with the iPhone SDK.  Things started off pretty slow in the morning as we both struggled to get some basic Cocos API and Objective-C calls working and with XCode a bit.  However once that was sorted out (or we developed workarounds) things started progressing.  It should be noted that once we cracked open our first beer we started getting productive.  I cannot lie.  That is actually what happened.

Here’s a list of some things we did accomplish and a bit of a translation of what they mean.

  • Cocos embedded as a subview of a UIScrollView object.  This will allows us to use flick/swipe movement already built into the iPhone SDK
  • Lots of ‘shrooms moving around.  Derek did some great work with this trying out some flocking algorithms just to get an idea for frame rates with some mushroom textures Matt & Nick have put together.
  • Hit detection.  You can select the mushrooms being displayed and select them as they are moving around.

Some admin work was also completed thanks to Derek…

  • Setup of Subverison repository.  Still some tweaks needed for authentication but mostly there.
  • Setup Mantis bug tracker
  • Setup Trac, project management tool (although we may not use it)

Overall it was a very productive day and as you can see from some of the previous posts by Matt we’ve got a few screenshots of what we have put together so far.  Enjoy.  If you are working with a small team and you have trouble making any progress I highly recommend dev sprints as a way to move forward with a sense of accomplishment.

Hardware Tests

Jul 22, 2009   //   by Matt Coombe   //   Development  //  2 Comments

Here’s a first look at Get Set’s initial project. The working title is Mushroom Bloom although that is likely to change in the near future.

During a code sprint yesterday we got our first running build on the iPhone.

Initial tests were for:

  • sprite display
  • sprite movement
  • Touch scrolling and flick scrolling
  • Recording single touch hits on sprites from the touch screen
  • activating vibration
  • sound playback on sprite hits

Here are some screen grabs of our first tests.

Get Set Games - Mushroom Bloom 01

Get Set Games - Mushroom Bloom 02

Welcome to Get Set Games

Jul 22, 2009   //   by Matt Coombe   //   Announcements  //  No Comments

Get Set is a new game development company formed in Toronto, Canada. We’re focused on creating totally awesome games for the iPhone platform and expect to release our first game this year. Get Set Games was incorporated officially last week and we received approval from Apple just yesterday to join the iPhone Developer Program so this is the very beginning of all things amazing.

The five members of our dev team have been working professionally for years in the games and real time 3D industries. We’ve got a lot of experience under our belts and we’re hoping to put that to good use on our upcoming projects. We have two artist/designers and three coders on board to get everything done.

We’ll be laying out all the details of our development excitement on this blog as we create our first game and get it up on the App Store. Hopefully some of what we share will be useful to the community.

Our Games