Skip to content

Instantly share code, notes, and snippets.

@tomekc
Created December 13, 2013 22:31
Show Gist options
  • Save tomekc/7952530 to your computer and use it in GitHub Desktop.
Save tomekc/7952530 to your computer and use it in GitHub Desktop.
Sparrow Framework 2.0 boilerplate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// create a full-screen window
CGRect screenBounds = [UIScreen mainScreen].bounds;
_window = [[UIWindow alloc] initWithFrame:screenBounds];
// start up Sparrow
_viewController = [[SPViewController alloc] init];
// IMPORTANT to enable depth test
// Remove if you do not need to display 3D content
GLKView *glkView = (GLKView *)_viewController.view;
glkView.drawableDepthFormat = GLKViewDrawableDepthFormat24;
[_viewController startWithRoot:[Game class] supportHighResolutions:YES doubleOnPad:YES];
// activate the window
[_window setRootViewController:_viewController];
[_window makeKeyAndVisible];
return YES;
}
#import <Foundation/Foundation.h>
#import <Sparrow-Framework/Sparrow.h>
@interface Game : SPSprite
@end
#import "Game.h"
@implementation Game
- (id)init {
self = [super init];
if (self) {
SPQuad *quad = [[SPQuad alloc] initWithWidth:50 height:50];
quad.color = 0xFF0000;
quad.x = 20;
quad.y = 20;
[self addChild:quad];
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment