daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## AppDelegate
  2.  
  3. #import "AppDelegate.h"
  4. #import "cocos2d.h"
  5. #import "GameScene.h"
  6.  
  7. @implementation AppDelegate
  8.  
  9. @synthesize window;
  10.  
  11. - (void)applicationDidFinishLaunching:(UIApplication *)application {    
  12.     window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  13.     [window setUserInteractionEnabled:YES];
  14.     [window setMultipleTouchEnabled:YES];
  15.    
  16.     [[Director sharedDirector] attachInView:window];
  17.    
  18.     GameScene *gs = [GameScene node];
  19.     [[Director sharedDirector] runWithScene:gs];
  20.    
  21.     [window makeKeyAndVisible];
  22. }
  23.  
  24. - (void)dealloc {
  25.     [window release];
  26.     [super dealloc];
  27. }
  28.  
  29. @end
  30.  
  31. ## GameScene
  32.  
  33. #import "GameScene.h"
  34. #import "cocos2d.h"
  35.  
  36. @implementation GameScene
  37.  
  38. @synthesize mainLayer;
  39.  
  40. - (id)init {
  41.     self = [super init];
  42.    
  43.     if ( self ) {
  44.         /*GameLayer *layer = [GameLayer node];
  45.         mainLayer = layer;
  46.         [layer release];*/
  47.        
  48.         CGSize size = [[Director sharedDirector] winSize];
  49.         int x = size.width;
  50.         int y = size.height;
  51.        
  52.         Sprite *bg = [Sprite spriteWithFile:@"background.png"];
  53.         bg.position = CGPointMake(x / 2, y / 2);
  54.         [self addChild:bg z:100];
  55.     }
  56.    
  57.     return self;
  58. }
  59.  
  60. @end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top