Having Fun With The iPhone SDK

I have been playing with the iPhone SDK since the spring time and it’s a lot of fun to program for the platform. There is something to be said for having something tangible at the end of the day. You can be anywhere and pull out your phone and say “Hey, check out what I have been working on”.

I have been porting over some Flash code libraries and games to it, which has been interesting because there are some differences on how Objective-C works compared to Flash.

The first and potentially most obvious is positioning objects. The counterpart to DisplayObject in the SDK is UIView. There are several properties that allow you to position objects, but the one you want to use is UIView.center. This is where Flash and the IPhone SDK differ a little because Flash, usually, deals with x,y in the top left, where the SDK deals with the registration point in the center. When you are porting over design and graphics from the Flash and laying everything out in Flash it’s easier to deal with top left instead of doing all the conversion to the center. Here is some methods that I wrote that subclasses UIView. I should also mention that self in Objective-C is this in Flash.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-(void)x:(float)_x 
{
    self.center = CGPointMake( _x + ( self.bounds.size.width / 2 ), self.center.y );
}
 
-(void)y:(float)_y 
{
    self.center = CGPointMake( self.center.x, _y + ( self.bounds.size.height / 2 ) );
}
 
-(float)y
{
    return self.center.y - ( self.bounds.size.height / 2 );
}
 
-(float)x
{
    return self.center.x - ( self.bounds.size.width / 2 );
}

You can also use the frame property to position items, but things will go a little wonky when trying to do a CGAffineTransform on the object at the same time you are position it. For example, rotating the object at the same time you are animating it’s position.

Some of you might be saying we’ll why don’t you use Interface Builder to lay everything out? The biggest reason is that we only have a few people working on OSX so the designers don’t have access to it. But I will say that Interface Builder is a wicked application and I am hoping Thermo lives up to it.

Continue reading » · Written on: 11-11-08 · No Comments »

PNG Image Cropper

At FOTB Brighton I presented on our process for developing the Fairies and Dragons Happy Meal toys. One of the things I showed was how we took a png sequence exported from Maya and cropped them to reduce the amount of alpha. To do that I built a WPF application in C# that would look at a folder and read in every png that was in there. For every image the application runs through each pixel and tries to determine all of the unnecessary alpha and crops it. The cool thing is that when the file gets saved out again it saves it with the x,y offset in the filename so that we can use a JSFL script to import all the images so the animation lines up.

Here is an example. Note : Everything in red is actually alpha I just filled it in for demonstration purposes.

Image Cropper

First select a input folder. This folder would have all of your images are in. Make sure the images are named sequentially.
Next select a output folder. It’s best if this folder is empty as this will be the folder where all of the cropped images will be placed.

Original Image

Here is a sample of the original image named Animation_Test.1.jpg.

Cropped Image

Here is the cropped image with the new name Animation_Test.1._163_95.jpg
As you can see it appends the x,y offset to the end of the filename ( 163, 95 ).

The final step is to run the JSFL command included with the application.

Select an empty layer on a timeline and run the command. It will prompt you to select a file from your output folder. Don’t worry which file it is because it is simply getting the folder not the file path. Flash will now import each image in the folder to a new keyframe and position the image at the x,y offset in the filename – in this case 163,95.

Feel free to download the application and give it a try.
You’ll need to have .NET 3 Framework installed for the application to run.

Continue reading » · Written on: 10-28-08 · 3 Comments »

Flash On The Beach 09 Miami

In case you missed the announcement at Flash on the Beach this year, the conference will be held in North American for the first time next April. Spring time is when the conference circuit really starts to get busy and I can’t think of a better way to start it then spending a week in South Beach. Like every Flash on the Beach conference it is likely to sell out so make sure to get your tickets early. The conference site has been refreshed and tickets go on sale in November. This year I went to my first Flash on the Beach in Brighton and had an absolute blast and I am sure 09 Miami and Brighton will be no different.

Continue reading » · Written on: 10-27-08 · No Comments »

Pixel Bender Install Location OSX

I was finally able to purchase and download Flash CS3 CS4 yesterday after a couple of days of trying. The adobe store just wouldn’t let me purchase a download. Anyways all is good now. I have been going through all of the new features in order to do a lunch and learn at our offices showing off what’s new. I’ll be posting stuff as I get my examples together as well as some changes that I have found in the Authoring Environment as well.

But the thing that drove me crazy all day today was trying to find the Pixel Bender Toolkit. I searched the docs and everything, but for whatever reason I couldn’t find anything that referenced the location. And Quicksilver didn’t find it either when I tried to open it using that.

Finally I found it by going to the labs page.

/Applications/Utilities/Adobe Utilities/Pixel Bender

There should be like a short cut or something from within the IDE. I guess that’s what JSFL is for.

Continue reading » · Written on: 10-18-08 · 2 Comments »

FlashPitt 08 Presentation Links

Here are the links that I showed in my presentation.

Places to buy

http://www.imagesco.com/

www.sparkfun.com
www.robotshop.ca
www.dgikey.com
www.jameco.com
www.phidgets.com

Reference

http://www.marumushi.com/apps/remotedriver2/

http://2005to2007.fabrica.it/tuned_stairs/old/index.html

http://www.uva.co.uk/archives/

http://www.arduino.cc

http://www.phidgets.com

Books
Physical Computing
Making Things Talk
http://terrisperber.mycyberway.com/celebrex9466.html
http://terrisperber.mycyberway.com/celebrex1571.html
http://terrisperber.mycyberway.com/celebrex1809.html

Continue reading » · Written on: 10-10-08 · 4 Comments »

FlashPitt this Friday

Just a reminder that Flashpitt is this Friday. I am really looking forward to this event as it is the first one, and I really enjoy the smaller conferences as it has a certain intimate feel to it that other bigger conference don’t have. I am really looking forward to seeing and meeting Golan Levin. If you aren’t familiar with his work check out his site chances are that you have seen some of it. He really does amazing work.I am going to be speaking about getting Ardunio and Phidgets to talk to Flash. I am going to show some examples and some projects that I have been working on. If you are interested in getting into this stuff than I recommend checking out the session. There will be a little bit of code, but just enough to get you started and pointed in the right direction to explore it on your own.

If you are going to be at the conference be sure to come say hi. I am also going to be there for most of the day after so if anyone has any suggestions on things to see in Pittsburgh let me know.

Continue reading » · Written on: 10-07-08 · No Comments »

Flash On The Beach Tickets End Tomorrow

This is just a friendly reminder that if you are thinking of going to Flash on the Beach, which you should be, that ticket sales end tomorrow.

There is only a few handful of tickets left so hurry now to get your place sorted out!

Continue reading » · Written on: 09-04-08 · No Comments »

Entourage: Kevin Dillion- Viking Quest Rant (HBO)

We recently worked with A&E to make a Viking Quest game to promote the upcoming season of Entourage. http://vikingquestgame.com/

http://www.youtube.com/watch?v=711gsvP96Zs
The video is of Johnny Drama ranting about how he isn’t getting any royalties from the game and he is pissed. It’s pretty hilarious and was a lot of fun to work on. Entourage premieres September 7,10pm.

Continue reading » · Written on: 09-02-08 · No Comments »

IDF Keynote Webcast is up

The IDF keynote that we were apart of is up online. It was my first IDF and I have to say I had a lot of fun.

http://www.intel.com/pressroom/kits/events/idffall_2008/video.htm?iid=idf_home+tab_audiovideo#

Session: Anand Chandrasekher
Click – launch webcast
Fast forward to 26 min and you will see Warren our CCO.

Continue reading » · Written on: 08-22-08 · No Comments »

Intel Developer Forum 08

I am just getting ready to walk into the rehearsal for the Keynote tomorrow morning on Intel Mobile Devices. We are going to be presenting in the first keynote in the morning and we also have a booth downstairs in the MID showcase section. If you are here stop by and say hi.

Continue reading » · Written on: 08-19-08 · No Comments »