Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## AppDelegate
- #import "AppDelegate.h"
- #import "cocos2d.h"
- #import "GameScene.h"
- @implementation AppDelegate
- @synthesize window;
- - (void)applicationDidFinishLaunching:(UIApplication *)application {
- window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- [window setUserInteractionEnabled:YES];
- [window setMultipleTouchEnabled:YES];
- [[Director sharedDirector] attachInView:window];
- GameScene *gs = [GameScene node];
- [[Director sharedDirector] runWithScene:gs];
- [window makeKeyAndVisible];
- }
- - (void)dealloc {
- [window release];
- [super dealloc];
- }
- @end
- ## GameScene
- #import "GameScene.h"
- #import "cocos2d.h"
- @implementation GameScene
- @synthesize mainLayer;
- - (id)init {
- self = [super init];
- if ( self ) {
- /*GameLayer *layer = [GameLayer node];
- mainLayer = layer;
- [layer release];*/
- CGSize size = [[Director sharedDirector] winSize];
- int x = size.width;
- int y = size.height;
- Sprite *bg = [Sprite spriteWithFile:@"background.png"];
- bg.position = CGPointMake(x / 2, y / 2);
- [self addChild:bg z:100];
- }
- return self;
- }
- @end
Add Comment
Please, Sign In to add comment