Advertisement
Guest User

Untitled

a guest
Apr 7th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)setupCocos3D {
  2.    
  3.     static int a = 0;
  4.     if(a == 0) {
  5.    
  6.         [[CCDirector sharedDirector] setOpenGLView:openGLView];  
  7.        
  8.  
  9.         ((ViewInterface*)[ViewInterface sharedViewInterface]).currentScene = [testScene scene];
  10.        
  11.        
  12.         // Create the customized CC3Layer that supports 3D rendering.
  13.         CC3Layer* cc3Layer = [HelloWorldLayer node];
  14.        
  15.         // Create the customized 3D scene and attach it to the layer.
  16.         // Could also just create this inside the customer layer.
  17.        
  18.        
  19.         cc3Layer.cc3Scene =  ((ViewInterface*)[ViewInterface sharedViewInterface]).currentScene;
  20.        
  21.         // Assign to a generic variable so we can uncomment options below to play with the capabilities
  22.         CC3ControllableLayer* mainLayer = cc3Layer;
  23.  
  24.         mainLayer.contentSize = CGSizeMake(2048, 1320);
  25.  
  26.         [CCDirector sharedDirector].animationInterval = (1.0f / kAnimationFrameRate);
  27.         [CCDirector sharedDirector].displayStats = YES;
  28.         [[CCDirector sharedDirector] enableRetinaDisplay: YES];
  29.        
  30.         ((ViewInterface*)[ViewInterface sharedViewInterface]).mainLayer = mainLayer;
  31.  
  32.         [[CCDirector sharedDirector] runWithScene:((ViewInterface*)[ViewInterface sharedViewInterface]).mainLayer];
  33.         a++;
  34.     }
  35.     else {
  36.         [[CCDirector sharedDirector] replaceScene:((ViewInterface*)[ViewInterface sharedViewInterface]).mainLayer];
  37.         [[CCDirector sharedDirector] startAnimation];
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement