RetroMacCast

Where great old Macs live again!

iPhone Programming for Apple IIGS developers

My son Ding Wen just ported some of his Apple IIGS programs to iPhone using GScript.


The programs can run natively on iPhone by embedding a full screen WebKit browser (UIWebView) to host a web application. All iPhone web technologies, including multi-touch, canvas and animation, can be used in the application.

This is how you can also do it as an iPhone developer (you can signed up free on Apple developer site, but to get it up and running on a real iPhone or iPod touch, you will need to sign up the US$99 developer program).

Step 1
Write a web application and tested them to work under iPhone Mobile Safari browser. If you have already learnt about Complete Pascal or other similar programming languages using QuickDraw, GScript will gives you a small subset of QuickDraw-like commands and Apple IIGS color palette that allows Apple IIGS programmer to easily port their programs to JavaScript.

Step 2
Create an Xcode project, and create a view-based iPhone application. Copy all HTML, JavaScript and related files into the Resources folder. Go to the Targets folder and open up your application folder - you should see a Copy Bundle Resources folder, make sure that all files that you wanted to use are there - by default all JavaScript files will be in Compile Sources - move them to Copy Bundle Resources folder.

Step 3
In the controller.m file, change the content of the loadView method to:

UIWebView *webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
self.view = webView;
[UIApplication sharedApplication].statusBarHidden = YES;
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]];
[webView release];

This code assuming the HTML file name to be index.html - change as you will.

You can now compile and get a running native application on your iPhone!

Ding Wen ported his Apple IIGS program Doodle Kids to iPhone.

You can also add sounds and other native iPhone technologies to the code later. Have fun!

Views: 709

Comment

You need to be a member of RetroMacCast to add comments!

Join RetroMacCast

Badge

Loading…

© 2018   Created by James.   Powered by

Badges  |  Report an Issue  |  Terms of Service