Skip to content

Instantly share code, notes, and snippets.

@tomekc

tomekc/Game.h

Created Dec 13, 2013
Embed
What would you like to do?
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
You can’t perform that action at this time.