HTML5 Game for the Mac App Store
This evening I took a break from tinkering with my HTML5 game to see if I could get it running as a native Cocoa app on OSX. I’d heard that I should be able to create a desktop app, add a WebView, then build and run it. I got it working and wanted to share my results! Create a new Cocoa Application. Add a WebView and expand it to fit the entire app surface. In the AppDelegate.m file I added this: -(void)applicationDidFinishLaunching:( NSNotification * ) aNotification { NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"]; [[self.webView mainFrame] loadRequest:[NSURLRequest requestWithURL:url]]; } In the AppDelegate.h file I added: #import <Cocoa/Cocoa.h> #import <WebKit/WebKit.h> @interface sudolinkAppDelegate : NSObject <NSApplicationDelegate> @property (assign) IBOutlet NSWindow *window; @property (weak) IBOutlet WebView *webView; @end I added the WebKit Fra...